# HG changeset patch # User Atul Varma # Date 1252353553 25200 # Node ID 8dd18f864351bc4ea8831fdef4f3a018c6310872 # Parent 057260102960ac9c6287d7da7f62c056653d1128 pydershell now exits with a nonzero return code if the script it calls throws an exception. diff -r 057260102960 -r 8dd18f864351 pydershell/pydershell.py --- a/pydershell/pydershell.py Mon Sep 07 12:57:20 2009 -0700 +++ b/pydershell/pydershell.py Mon Sep 07 12:59:13 2009 -0700 @@ -295,11 +295,13 @@ return jsvalue def run_script(self, filename): + retval = -1 contents = open(filename).read() cx = self.cx try: cx.evaluate_script(self.root.wrapped_jsobject, contents, filename, 1) + retval = 0 except pydermonkey.error, e: print format_stack(self.js_stack) print e.args[1] @@ -307,6 +309,7 @@ print "An internal error occurred." traceback.print_tb(e.exc_info[2]) print e.exc_info[1] + return retval if __name__ == '__main__': sandbox = JSSandbox() @@ -323,7 +326,7 @@ print string sandbox.root['print'] = jsprint - sandbox.run_script('test.js') + retval = sandbox.run_script('test.js') sandbox.finish() del sandbox @@ -332,3 +335,5 @@ gc.collect() if pydermonkey.get_debug_info()['runtime_count']: print "WARNING: JS runtime was not destroyed." + + sys.exit(retval)