changeset 227:e8170eba88cd

apply-patchbomb: clean up imports and improve exit status
author Augie Fackler <durin42@gmail.com>
date Mon, 04 Oct 2010 21:47:22 -0500
parents f8a4c55ad070
children 0c8939baa35c
files unixSoft/bin/apply-patchbomb
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/unixSoft/bin/apply-patchbomb
+++ b/unixSoft/bin/apply-patchbomb
@@ -6,10 +6,11 @@
 This uses the scripting bridge to talk to Mail and subprocess to pass the
 patch to Mercurial on stdin.
 """
-
+import email
+import subprocess
+import sys
 
 import ScriptingBridge
-import subprocess
 
 def main():
     mail = ScriptingBridge.SBApplication.applicationWithBundleIdentifier_(
@@ -23,7 +24,8 @@ def main():
         p.stdin.close()
         if p.wait() != 0:
             print 'hg import failed, bailing'
-            break
+            return 2
+    return 0
 
 if __name__ == '__main__':
-    main()
+    sys.exit(main())