Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/ocx-run
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ echo "started=$(date -Is) name=$name limit=$limit cmd=$*" > "$status"

# setsid gives the job its own process group so a timeout kills the children too;
# --kill-after upgrades to SIGKILL for a process that ignores SIGTERM.
setsid timeout --signal=TERM --kill-after=60s "$limit" "$@" > "$log" 2>&1 &
(cd "$workdir" && exec setsid timeout --signal=TERM --kill-after=60s "$limit" "$@") > "$log" 2>&1 &

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat hyphen-leading workdirs as paths

When scripts/ocx-run receives a valid relative workdir named -, the preceding -d check succeeds, but Bash interprets cd "-" as a request to switch to $OLDPWD; the wrapped command therefore succeeds in the wrong directory. Other hyphen-leading directory names can instead be parsed as invalid options. Use cd -- "$workdir" (or canonicalize the path) so every validated workdir is treated as a directory operand.

Useful? React with 👍 / 👎.

job=$!
echo "$job" > "$pidf"

Expand Down
Loading