dumb-init/tests/exit_status_test.py

12 lines
379 B
Python
Raw Normal View History

2015-09-12 01:57:22 +03:00
from subprocess import Popen
def test_exit_status(both_debug_modes, both_setsid_modes):
"""dumb-init should exit with the same exit status as the process that it
supervises.
"""
for status in [0, 1, 2, 32, 64, 127, 254, 255]:
proc = Popen(('dumb-init', 'sh', '-c', 'exit {}'.format(status)))
proc.wait()
assert proc.returncode == status