changeset 37:38aa4f49f095

untested redo of edit
author devlinjs@FA7CZA6N1254998.wrightpatterson.afmc.ds.af.mil
date Fri, 21 Dec 2007 16:37:21 -0500
parents 6315f75c45ae
children ed1f390c142d
files cmd2.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/cmd2.py	Fri Dec 21 16:35:50 2007 -0500
+++ b/cmd2.py	Fri Dec 21 16:37:21 2007 -0500
@@ -255,6 +255,7 @@
 	    print "please use 'set editor' to specify your text editing program of choice."
 	    return
 	filename = self.defaultFileName
+	buffer = ''
 	try:
 	    arg = int(arg)
 	    buffer = self.last_matching(arg)
@@ -263,10 +264,12 @@
 		filename = arg
 	    else:
 		buffer = self.last_matching(arg)
-		f = open(filename, 'w')
-		f.write(buffer or '')
-		f.close()		
 
+	if buffer:
+	    f = open(filename, 'w')
+	    f.write(buffer or '')
+	    f.close()	
+		
 	os.system('%s %s' % (self.editor, filename))
         self.do_load(self.filename)
     do_edit = do_ed