diff --git a/tools/process_registry.py b/tools/process_registry.py index 00a8a3257..b04188d28 100644 --- a/tools/process_registry.py +++ b/tools/process_registry.py @@ -247,8 +247,9 @@ class ProcessRegistry: # Run the command in the sandbox with output capture log_path = f"/tmp/hermes_bg_{session.id}.log" pid_path = f"/tmp/hermes_bg_{session.id}.pid" + safe_command = command.replace("'", "'\''") bg_command = ( - f"nohup bash -c '{command}' > {log_path} 2>&1 & " + f"nohup bash -c '{safe_command}' > {log_path} 2>&1 & " f"echo $! > {pid_path} && cat {pid_path}" )