fix(process): escape single quotes in spawn_via_env bg_command
This commit is contained in:
@@ -227,8 +227,9 @@ class ProcessRegistry:
|
|||||||
# Run the command in the sandbox with output capture
|
# Run the command in the sandbox with output capture
|
||||||
log_path = f"/tmp/hermes_bg_{session.id}.log"
|
log_path = f"/tmp/hermes_bg_{session.id}.log"
|
||||||
pid_path = f"/tmp/hermes_bg_{session.id}.pid"
|
pid_path = f"/tmp/hermes_bg_{session.id}.pid"
|
||||||
|
safe_command = command.replace("'", "'\''")
|
||||||
bg_command = (
|
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}"
|
f"echo $! > {pid_path} && cat {pid_path}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user