diff unixSoft/bin/apply-patchbomb @ 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 b5d71972aa72
children 4b661cede8ad
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())