mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 00:14:41 +01:00
Allow non-integer exit codes (#5721)
* Allow non-integer exit codes justl like in Python proper * doc: add news item * Update fr-exit-str.rst --------- Co-authored-by: Andy Kipp <anki-code@users.noreply.github.com>
This commit is contained in:
parent
c85b8923a0
commit
4c0b223e7b
2 changed files with 31 additions and 1 deletions
23
news/fr-exit-str.rst
Normal file
23
news/fr-exit-str.rst
Normal file
|
@ -0,0 +1,23 @@
|
|||
**Added:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Changed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* Fixed non-int sys.exit codes raising ValueError.
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
|
@ -606,7 +606,14 @@ def main_xonsh(args):
|
|||
err_type, err, _ = exc_info
|
||||
if err_type is SystemExit:
|
||||
code = getattr(exc_info[1], "code", 0)
|
||||
exit_code = int(code) if code is not None else 0
|
||||
if code is None:
|
||||
exit_code = 0
|
||||
else:
|
||||
exit_code = code
|
||||
try:
|
||||
exit_code = int(code)
|
||||
except ValueError:
|
||||
pass
|
||||
XSH.exit = exit_code
|
||||
else:
|
||||
exit_code = 1
|
||||
|
|
Loading…
Add table
Reference in a new issue