From 14cb32ecd623ad2f179f543c21f33a5488f4fbd1 Mon Sep 17 00:00:00 2001 From: Ruben Gonzalez Date: Fri, 16 Feb 2024 20:25:21 +0100 Subject: [PATCH] ffmpeg: pass -nostdin to not alter the terminal settings to begin with. Fix issue with Bash Linux terminal does not echo the input characters after running a full test suite. Thanks to Kerin Millar for the help in the bash list [1] The issue could be reproduced with ``` from multiprocessing import Pool from unittest.result import TestResult from time import perf_counter import subprocess jobs=3 failfast=False timeout=30 verbose=True tests = [1,2,3] def run_command(command, verbose = False, check = True, timeout = None): """Runs a command""" sout = subprocess.DEVNULL if not verbose else None serr = subprocess.DEVNULL if not verbose else None if verbose: print(f'\nRunning command "{" ".join(command)}"') try: subprocess.run(command, stdout=sout, stderr=serr, check=check, timeout=timeout) except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as ex: raise ex def _run_worker(test): print("running", test) cmd = ['ffmpeg'] out = run_command(cmd, timeout=timeout, verbose=verbose) return out with Pool(jobs) as pool: def _callback(test_result) -> None: print( test_result, flush=True, ) if failfast: pool.terminate() start = perf_counter() for test in tests: pool.apply_async(_run_worker, (test,), callback=_callback) pool.close() pool.join() ``` Fixes #147 [1] https://lists.gnu.org/archive/html/help-bash/2024-02/msg00084.html --- fluster/decoders/ffmpeg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fluster/decoders/ffmpeg.py b/fluster/decoders/ffmpeg.py index 96d4cae7..295d5cee 100644 --- a/fluster/decoders/ffmpeg.py +++ b/fluster/decoders/ffmpeg.py @@ -27,7 +27,7 @@ from fluster.decoder import Decoder, register_decoder from fluster.utils import file_checksum, run_command -FFMPEG_TPL = "{} -i {} {} -vf {}format=pix_fmts={} -f rawvideo {}" +FFMPEG_TPL = "{} -nostdin -i {} {} -vf {}format=pix_fmts={} -f rawvideo {}" def output_format_to_ffformat(output_format: OutputFormat) -> str: