Ticket #206: paste_script_daemon.patch
| File paste_script_daemon.patch, 1.5 KB (added by osantana, 5 years ago) |
|---|
-
../python/lib/python2.5/site-packages/PasteScript-1.3.6-py2.5.egg/paste/script/serve.py
old new 25 25 26 26 MAXFD = 1024 27 27 28 class DaemonizeException(Exception): 29 pass 30 31 28 32 class ServeCommand(Command): 29 33 30 34 min_args = 0 … … 201 205 writeable_log_file.close() 202 206 203 207 if self.options.daemon: 204 self.daemonize() 208 try: 209 self.daemonize() 210 except DaemonizeException, ex: 211 if self.verbose > 0: 212 print str(ex) 213 return 205 214 206 215 if self.options.pid_file: 207 216 self.record_pid(self.options.pid_file) … … 250 259 **kw) 251 260 252 261 def daemonize(self): 262 if not self.options.pid_file: 263 self.options.pid_file = 'paster.pid' 264 265 pid = live_pidfile(self.options.pid_file) 266 if pid: 267 raise DaemonizeException("Daemon is already running (PID: %s)" % (pid,)) 268 253 269 if self.verbose > 0: 254 270 print 'Entering daemon mode' 255 271 pid = os.fork() … … 287 303 os.dup2(0, 1) # standard output (1) 288 304 os.dup2(0, 2) # standard error (2) 289 305 290 if not self.options.pid_file:291 self.options.pid_file = 'paster.pid'292 306 if not self.options.log_file: 293 307 self.options.log_file = 'paster.log' 294 308
