Fix exit code for commands terminated by signals

Fixes https://github.com/pre-commit/pre-commit/issues/2970
This commit is contained in:
Chris Kuehl 2023-08-21 20:02:27 -05:00
parent a1f1d19156
commit 5a4b5b1f8e
2 changed files with 11 additions and 1 deletions

View file

@ -147,6 +147,15 @@ def test_xargs_retcode_normal():
assert ret == 5
@pytest.mark.xfail(sys.platform == 'win32', reason='posix only')
def test_xargs_retcode_killed_by_signal():
ret, _ = xargs.xargs(
parse_shebang.normalize_cmd(('bash', '-c', 'kill -9 $$', '--')),
('foo', 'bar'),
)
assert ret == -9
def test_xargs_concurrency():
bash_cmd = parse_shebang.normalize_cmd(('bash', '-c'))
print_pid = ('sleep 0.5 && echo $$',)