[Zodb-checkins] CVS: ZODB3/zdaemon - zdctl.py:1.27

Guido van Rossum guido@python.org
Thu, 23 Jan 2003 15:41:54 -0500


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

Modified Files:
	zdctl.py 
Log Message:
Add a shell command.  (The '!' alias is implemented by the cmd.py base
class.)


=== ZODB3/zdaemon/zdctl.py 1.26 => 1.27 ===
--- ZODB3/zdaemon/zdctl.py:1.26	Thu Jan 23 15:34:28 2003
+++ ZODB3/zdaemon/zdctl.py	Thu Jan 23 15:41:51 2003
@@ -402,6 +402,19 @@
         print "                     A default file may exist."
         print "                     Hit ^C to exit this mode."
 
+    def do_shell(self, arg):
+        if not arg:
+            arg = os.getenv("SHELL") or "/bin/sh"
+        try:
+            os.system(arg)
+        except KeyboardInterrupt:
+            print
+
+    def help_shell(self):
+        print "shell [command] -- Execute a shell command."
+        print "                   Without a command, start an interactive sh."
+        print "An alias for this command is ! [command]"
+
     def do_quit(self, arg):
         self.get_status()
         if not self.zd_up: