Stop the e-mail sending if editor fails
authorCatalin Marinas <catalin.marinas@gmail.com>
Mon, 5 Feb 2007 22:41:41 +0000 (22:41 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Mon, 5 Feb 2007 22:41:41 +0000 (22:41 +0000)
With this patch, if the editor exits with a non-zero status, stop
sending any e-mails.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/commands/mail.py

index 7f20f13..cf470f1 100644 (file)
@@ -290,7 +290,10 @@ def __edit_message(msg):
 
     print 'Invoking the editor: "%s"...' % editor,
     sys.stdout.flush()
-    print 'done (exit code: %d)' % os.system(editor)
+    err = os.system(editor)
+    if err:
+        raise CmdException, 'editor failed, exit code: %d' % err
+    print 'done'
 
     # read the message back
     f = file(fname)