We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 64ea8c1 commit 6fef444Copy full SHA for 6fef444
src/ffmpeg_media_type/exceptions.py
@@ -0,0 +1,2 @@
1
+class FfmpegMediaTypeError(Exception):
2
+ pass
src/ffmpeg_media_type/utils/shell.py
@@ -2,14 +2,17 @@
import shlex
3
import tempfile
4
5
+from ..exceptions import FfmpegMediaTypeError
6
+
7
8
def call(cmds: list[str]) -> str:
9
# call command and return stdout
10
11
command = " ".join(shlex.quote(part) for part in cmds)
12
with tempfile.TemporaryDirectory() as tmpdir:
13
output_path = f"{tmpdir}/output.txt"
- assert os.system(f"{command} > {output_path}") == 0, f"command failed: {command}"
14
+ if os.system(f"{command} > {output_path}") != 0:
15
+ raise FfmpegMediaTypeError(f"command failed: {command}")
16
17
with open(output_path) as ifile:
18
return ifile.read()
0 commit comments