Skip to content

Commit

Permalink
Merge pull request #465 from jerome-nexedi/fix/exit-code-D
Browse files Browse the repository at this point in the history
debugger: Exit with error code on debugged error
  • Loading branch information
reinout committed Sep 3, 2018
2 parents 1a55f2a + 68c582a commit 42f80fa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Change History
2.12.2 (unreleased)
===================

- Nothing changed yet.
- Exit program with error code on error when running with ``-D``.


2.12.1 (2018-07-02)
Expand Down
2 changes: 1 addition & 1 deletion src/zc/buildout/buildout.py
Original file line number Diff line number Diff line change
Expand Up @@ -2149,7 +2149,7 @@ def main(args=None):
else:
sys.stderr.write(_internal_error_template)
traceback.print_exception(*exc_info)
sys.exit(1)
sys.exit(1)

finally:
logging.shutdown()
Expand Down
6 changes: 4 additions & 2 deletions src/zc/buildout/debugging.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@ And create a buildout that uses it:

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'
Installing data-dir.
While:
Installing data-dir.
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
Expand All @@ -71,7 +72,7 @@ supply some input:
... up
... p sorted(self.options.keys())
... q
... """), end='')
... """, with_exit_code=True), end='')
Develop: '/sample-buildout/recipes'
Installing data-dir.
> /zc/buildout/buildout.py(925)__getitem__()
Expand All @@ -95,3 +96,4 @@ supply some input:
MissingOption: Missing option: data-dir:directory
<BLANKLINE>
Starting pdb:
EXIT CODE: 1

0 comments on commit 42f80fa

Please sign in to comment.