issue #527: catch new-style module tracebacks like vanilla.
This commit is contained in:
parent
e8e66d6fd0
commit
954f874085
|
@ -42,6 +42,7 @@ import shlex
|
|||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import traceback
|
||||
import types
|
||||
|
||||
import mitogen.core
|
||||
|
@ -871,6 +872,11 @@ class NewStyleRunner(ScriptRunner):
|
|||
except SystemExit:
|
||||
exc = sys.exc_info()[1]
|
||||
rc = exc.args[0]
|
||||
except Exception:
|
||||
# This writes to stderr by default.
|
||||
traceback.print_exc()
|
||||
rc = 1
|
||||
|
||||
finally:
|
||||
self.atexit_wrapper.run_callbacks()
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
- include: atexit.yml
|
||||
- include: builtin_command_module.yml
|
||||
- include: crashy_new_style_module.yml
|
||||
- include: custom_bash_hashbang_argument.yml
|
||||
- include: custom_bash_old_style_module.yml
|
||||
- include: custom_bash_want_json_module.yml
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# issue #527: catch exceptions from crashy modules.
|
||||
|
||||
- name: integration/runner/crashy_new_style_module.yml
|
||||
hosts: test-targets
|
||||
tasks:
|
||||
- custom_python_run_script:
|
||||
script: kaboom
|
||||
register: out
|
||||
ignore_errors: true
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- not out.changed
|
||||
- out.rc == 1
|
||||
- out.msg == "MODULE FAILURE"
|
||||
- out.module_stdout == ""
|
||||
- "'Traceback (most recent call last)' in out.module_stderr"
|
||||
- "\"NameError: name 'kaboom' is not defined\" in out.module_stderr"
|
Loading…
Reference in New Issue