Commit ae5016d0 authored by Jérome Perrin's avatar Jérome Perrin Committed by Julien Muchembled

debugger: Exit with error code on debugged error

When buildout encounter an error, program exists with error code 1, this
should also be the case when exiting from a debugger session when
running with -D option.

/reviewed-on !17
parent 37808c09
...@@ -2261,7 +2261,7 @@ def main(args=None): ...@@ -2261,7 +2261,7 @@ def main(args=None):
else: else:
sys.stderr.write(_internal_error_template) sys.stderr.write(_internal_error_template)
traceback.print_exception(*exc_info) traceback.print_exception(*exc_info)
sys.exit(1) sys.exit(1)
finally: finally:
logging.shutdown() logging.shutdown()
......
...@@ -56,12 +56,13 @@ And create a buildout that uses it: ...@@ -56,12 +56,13 @@ And create a buildout that uses it:
If we run the buildout, we'll get an error: If we run the buildout, we'll get an error:
>>> print_(system(buildout), end='') >>> print_(system(buildout, with_exit_code=True), end='')
Develop: '/sample-buildout/recipes' Develop: '/sample-buildout/recipes'
Installing data-dir. Installing data-dir.
While: While:
Installing data-dir. Installing data-dir.
Error: Missing option: data-dir:directory Error: Missing option: data-dir:directory
EXIT CODE: 1
If we want to debug the error, we can add the -D option. Here's we'll If we want to debug the error, we can add the -D option. Here's we'll
...@@ -71,7 +72,7 @@ supply some input: ...@@ -71,7 +72,7 @@ supply some input:
... up ... up
... p sorted(self.options.keys()) ... p sorted(self.options.keys())
... q ... q
... """), end='') ... """, with_exit_code=True), end='')
Develop: '/sample-buildout/recipes' Develop: '/sample-buildout/recipes'
Installing data-dir. Installing data-dir.
> /zc/buildout/buildout.py(925)__getitem__() > /zc/buildout/buildout.py(925)__getitem__()
...@@ -97,3 +98,4 @@ supply some input: ...@@ -97,3 +98,4 @@ supply some input:
MissingOption: Missing option: data-dir:directory MissingOption: Missing option: data-dir:directory
<BLANKLINE> <BLANKLINE>
Starting pdb: Starting pdb:
EXIT CODE: 1
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment