Merge pull request #72 from JeWe37/master

This commit is contained in:
Joshua M. Boniface 2023-08-16 21:57:26 -04:00 committed by GitHub
commit a831afe59b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

13
rffmpeg
View file

@ -25,6 +25,7 @@ import logging
import os
import signal
import sys
import shlex
import yaml
from contextlib import contextmanager
@ -471,16 +472,8 @@ def run_remote_command(
stdout = sys.stderr
else:
stdout = sys.stdout
# Append all the passed arguments with requoting of any problematic characters
for arg in command_args:
# Escape $ characters
arg = arg.replace('$', '\\$')
# Match bad shell characters: * ' ( ) | [ ] or whitespace
if search("[*'()|\[\]\s]", arg):
rffmpeg_command.append(f'"{arg}"')
else:
rffmpeg_command.append(f"{arg}")
rffmpeg_command.extend(map(shlex.quote, command_args))
log.info(f"Running command on host '{target_hostname}' ({target_servername})")
log.debug(f"Remote command: {' '.join(rffmpeg_ssh_command + rffmpeg_command)}")