changeset 355:5972ae04515e

EOF is now the 'unusual' stop signal
author catherine@dellzilla
date Wed, 17 Feb 2010 12:32:49 -0500
parents 7cd04727f7f7
children d275d3beceff
files cmd2.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/cmd2.py	Wed Feb 17 12:08:42 2010 -0500
+++ b/cmd2.py	Wed Feb 17 12:32:49 2010 -0500
@@ -415,7 +415,8 @@
                 self.poutput(msg)
             else:
                 print (msg)
-    _STOP_AND_EXIT = 2  # distinguish end of script file from actual exit
+    _STOP_AND_EXIT = True  # distinguish end of script file from actual exit
+    _STOP_SCRIPT_NO_EXIT = -999
     editor = os.environ.get('EDITOR')
     if not editor:
         if sys.platform[:3] == 'win':
@@ -911,7 +912,7 @@
             return stop
 
     def do_EOF(self, arg):
-        return True
+        return self._STOP_SCRIPT_NO_EXIT # End of script; should not exit app
     do_eof = do_EOF
                            
     def do_quit(self, arg):
@@ -1198,7 +1199,7 @@
         self.stdin.close()
         keepstate.restore()
         self.lastcmd = ''
-        return (stop == self._STOP_AND_EXIT) and self._STOP_AND_EXIT    
+        return stop and (stop != self._STOP_SCRIPT_NO_EXIT)    
     do__load = do_load  # avoid an unfortunate legacy use of do_load from sqlpython
     
     def do_run(self, arg):