One function

create_shell_process in tusharsadhwani/zxpy

The author described this change as Make zxpy raise on error. It counts as a record because the check below fails on the code as it stood at 0c067d3ac and passes on 975e9b0ed, with nothing else changed between the two runs.

Fix saved2021-09-28
Sharing licenceMIT · LICENSE
Change size+8 1

What the code was meant to do, written into the code itself as a docstring

Creates a shell process, returning its stdout to read data from.

The change

11 def create_shell_process(command: str) -> IO[bytes]:
22 """Creates a shell process, returning its stdout to read data from."""
33 process = subprocess.Popen(
4- command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True
4+ command,
5+ stdout=subprocess.PIPE,
6+ stderr=subprocess.STDOUT,
7+ shell=True,
58 )
9+ process.wait()
10+ if process.returncode != 0:
11+ raise ChildProcessError(process.returncode)
12+
613 assert process.stdout is not None
714 return process.stdout

The check that tells the two apart

failpass·tests/zxpy_test.py::test_raise

Check file tests/zxpy_test.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it0c067d3acdd9fd2adf0ad1b4bed1fbff641fe2b8
Broken version dated2021-09-28
Modulezx
Units changedcreate_shell_process
Fingerprint9e2a04b7e545ac1c
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.