Public » MiniRedis Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

support storing a PID

Changeset 6dc10eea7cb7

Parent 8c1a60012225

by Profile picture of Benjamin PollackBenjamin Pollack

Changes to one file · Browse files at 6dc10eea7cb7 Showing diff from parent 8c1a60012225 Diff from another changeset...

Change 1 of 2 Show Entire File miniredis.py Stacked
 
296
297
298
299
 
 
300
301
302
 
306
307
308
 
 
 
 
 
309
310
311
312
313
 
 
314
315
316
 
296
297
298
 
299
300
301
302
303
 
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
@@ -296,7 +296,8 @@
  signal.signal(signal.SIGHUP, sighup)     host, port, log_file, db_file = '127.0.0.1', 6379, None, None - opts, args = getopt.getopt(args, 'h:p:d:l:') + opts, args = getopt.getopt(args, 'h:p:d:l:f:') + pid_file = None   for o, a in opts:   if o == '-h':   host = a @@ -306,11 +307,18 @@
  log_file = os.path.abspath(a)   elif o == '-d':   db_file = os.path.abspath(a) + elif o == '-f': + pid_file = os.path.abspath(a) + if pid_file: + with open(pid_file, 'w') as f: + f.write('%s\n' % os.getpid())   m = MiniRedis(host=host, port=port, log_file=log_file, db_file=db_file)   try:   m.run()   except KeyboardInterrupt:   m.stop() + if pid_file: + os.unlink(pid_file)   sys.exit(0)    if __name__ == '__main__':