One function

FFRuntimeError in Ch00k/ffmpy

The author described this change as Fix exception raising for all types of stdout/stderr (#90). It counts as a record because the check below fails on the code as it stood at 57c12058a and passes on 5941c92a4, with nothing else changed between the two runs.

Fix saved2025-10-22
Sharing licenceMIT · LICENSE
Change size+14 2

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

Raise when FFmpeg/FFprobe command line execution returns a non-zero exit code. The resulting exception object will contain the attributes relates to command line execution: `cmd`, `exit_code`, `stdout`, `stderr`.

The change

55 ``cmd``, ``exit_code``, ``stdout``, ``stderr``.
66 """
77
8- def __init__(self, cmd: str, exit_code: int, stdout: bytes, stderr: bytes) -> None:
8+ def __init__(
9+ self,
10+ cmd: str,
11+ exit_code: int,
12+ stdout: bytes | str | None,
13+ stderr: bytes | str | None,
14+ ) -> None:
915 self.cmd = cmd
1016 self.exit_code = exit_code
1117 self.stdout = stdout
1218 self.stderr = stderr
1319
20+ stdout_display = _safe_decode(stdout)
21+ stderr_display = _safe_decode(stderr)
22+
1423 message = "`{}` exited with status {}\n\nSTDOUT:\n{}\n\nSTDERR:\n{}".format(
15- self.cmd, exit_code, (stdout or b"").decode(), (stderr or b"").decode()
24+ self.cmd,
25+ exit_code,
26+ stdout_display,
27+ stderr_display,
1628 )
1729
1830 super().__init__(message)

The check that tells the two apart

failpass·tests/test_cmd_execution.py::test_runtime_error_with_text_mode

Check file tests/test_cmd_execution.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 it57c12058a525c30f61ee2a7c8c91cd11191c8dd4
Broken version dated2025-10-11
Moduleffmpy.ffmpy
Units changedFFRuntimeError
Fingerprint528b4f140f4741ab
Checked2026-08-18 by goldset/0.1

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