Merge pull request #116 from chriskuehl/use-bin-bash-exit-status-test
Fix exit_status_test on Fedora
This commit is contained in:
commit
a91de79a9e
1 changed files with 7 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
import signal
|
||||
import sys
|
||||
from subprocess import Popen
|
||||
|
||||
import pytest
|
||||
|
@ -17,7 +18,7 @@ def test_exit_status_regular_exit(exit_status):
|
|||
|
||||
@pytest.mark.parametrize('signal', [
|
||||
signal.SIGTERM,
|
||||
signal.SIGINT,
|
||||
signal.SIGHUP,
|
||||
signal.SIGQUIT,
|
||||
signal.SIGKILL,
|
||||
])
|
||||
|
@ -26,6 +27,10 @@ def test_exit_status_terminated_by_signal(signal):
|
|||
"""dumb-init should exit with status 128 + signal when the child process is
|
||||
terminated by a signal.
|
||||
"""
|
||||
proc = Popen(('dumb-init', 'sh', '-c', 'kill -{0} $$'.format(signal)))
|
||||
# We use Python because sh is "dash" on Debian and "bash" on others.
|
||||
# https://github.com/Yelp/dumb-init/issues/115
|
||||
proc = Popen(('dumb-init', sys.executable, '-c', 'import os; os.kill(os.getpid(), {0})'.format(
|
||||
signal,
|
||||
)))
|
||||
proc.wait()
|
||||
assert proc.returncode == 128 + signal
|
||||
|
|
Loading…
Reference in a new issue