[Zope-Checkins] CVS: ZODB3/zdaemon - zdctl.py:1.31

Guido van Rossum guido@python.org
Fri, 24 Jan 2003 12:08:46 -0500


Update of /cvs-repository/ZODB3/zdaemon
In directory cvs.zope.org:/tmp/cvs-serv25140

Modified Files:
	zdctl.py 
Log Message:
Add another command, "foreground" (or "fg") which runs the server
process in the foreground.


=== ZODB3/zdaemon/zdctl.py 1.30 => 1.31 ===
--- ZODB3/zdaemon/zdctl.py:1.30	Fri Jan 24 08:04:08 2003
+++ ZODB3/zdaemon/zdctl.py	Fri Jan 24 12:08:44 2003
@@ -442,6 +442,27 @@
         print "    command line, except that if no -C option is given,"
         print "    the last configuration file is used."
 
+    def do_foreground(self, arg):
+        self.get_status()
+        pid = self.zd_pid
+        if pid:
+            print "To run the program in the foreground, please stop it first."
+            return
+        program = " ".join(self.options.program)
+        print program
+        try:
+            os.system(program)
+        except KeyboardInterrupt:
+            print
+
+    do_fg = do_foreground
+
+    def help_foreground(self):
+        print "foreground -- Run the program in the forground."
+        print "fg -- an alias for foreground."
+
+    help_fg = help_foreground
+
     def do_quit(self, arg):
         self.get_status()
         if not self.zd_up: