diff --git a/ffmpeg/_run.py b/ffmpeg/_run.py index 070a763..8048abf 100644 --- a/ffmpeg/_run.py +++ b/ffmpeg/_run.py @@ -106,10 +106,10 @@ def get_args(node): def run(node, cmd='ffmpeg'): """Run ffmpeg on node graph.""" if isinstance(cmd, basestring): - args = [cmd] + cmd = [cmd] elif type(cmd) != list: - args = list(cmd) - args += node.get_args() + cmd = list(cmd) + args = cmd + node.get_args() _subprocess.check_call(args) diff --git a/ffmpeg/tests/test_ffmpeg.py b/ffmpeg/tests/test_ffmpeg.py index 2a6fc58..e32c5c6 100644 --- a/ffmpeg/tests/test_ffmpeg.py +++ b/ffmpeg/tests/test_ffmpeg.py @@ -1,5 +1,6 @@ import ffmpeg import os +import pytest import subprocess @@ -118,4 +119,21 @@ def test_get_args_complex_filter(): def test_run(): - ffmpeg.run(_get_complex_filter_example()) + node = _get_complex_filter_example() + ffmpeg.run(node) + + +def test_run_dummy_cmd(): + node = _get_complex_filter_example() + ffmpeg.run(node, cmd='true') + + +def test_run_dummy_cmd_list(): + node = _get_complex_filter_example() + ffmpeg.run(node, cmd=['true', 'ignored']) + + +def test_run_failing_cmd(): + node = _get_complex_filter_example() + with pytest.raises(subprocess.CalledProcessError): + ffmpeg.run(node, cmd='false')