Merge pull request #208354 from bjornfor/nixos-test-driver-quote-shell-args
nixos/test-driver: quote some shell command lines
This commit is contained in:
commit
869545857f
|
@ -101,14 +101,14 @@ def _perform_ocr_on_screenshot(
|
||||||
|
|
||||||
tess_args = f"-c debug_file=/dev/null --psm 11"
|
tess_args = f"-c debug_file=/dev/null --psm 11"
|
||||||
|
|
||||||
cmd = f"convert {magick_args} {screenshot_path} tiff:{screenshot_path}.tiff"
|
cmd = f"convert {magick_args} '{screenshot_path}' 'tiff:{screenshot_path}.tiff'"
|
||||||
ret = subprocess.run(cmd, shell=True, capture_output=True)
|
ret = subprocess.run(cmd, shell=True, capture_output=True)
|
||||||
if ret.returncode != 0:
|
if ret.returncode != 0:
|
||||||
raise Exception(f"TIFF conversion failed with exit code {ret.returncode}")
|
raise Exception(f"TIFF conversion failed with exit code {ret.returncode}")
|
||||||
|
|
||||||
model_results = []
|
model_results = []
|
||||||
for model_id in model_ids:
|
for model_id in model_ids:
|
||||||
cmd = f"tesseract {screenshot_path}.tiff - {tess_args} --oem {model_id}"
|
cmd = f"tesseract '{screenshot_path}.tiff' - {tess_args} --oem '{model_id}'"
|
||||||
ret = subprocess.run(cmd, shell=True, capture_output=True)
|
ret = subprocess.run(cmd, shell=True, capture_output=True)
|
||||||
if ret.returncode != 0:
|
if ret.returncode != 0:
|
||||||
raise Exception(f"OCR failed with exit code {ret.returncode}")
|
raise Exception(f"OCR failed with exit code {ret.returncode}")
|
||||||
|
@ -744,7 +744,7 @@ class Machine:
|
||||||
{"image": os.path.basename(filename)},
|
{"image": os.path.basename(filename)},
|
||||||
):
|
):
|
||||||
self.send_monitor_command(f"screendump {tmp}")
|
self.send_monitor_command(f"screendump {tmp}")
|
||||||
ret = subprocess.run(f"pnmtopng {tmp} > {filename}", shell=True)
|
ret = subprocess.run(f"pnmtopng '{tmp}' > '{filename}'", shell=True)
|
||||||
os.unlink(tmp)
|
os.unlink(tmp)
|
||||||
if ret.returncode != 0:
|
if ret.returncode != 0:
|
||||||
raise Exception("Cannot convert screenshot")
|
raise Exception("Cannot convert screenshot")
|
||||||
|
|
Loading…
Reference in a new issue