Fix --detach-process for standalone CLI - #12873
Conversation
wuisabel-gif
left a comment
There was a problem hiding this comment.
The child marker should be inserted before any -- end-of-options separator rather than appended to the argument list. With an invocation such as rerun --detach-process -- recording.rrd, the child receives rerun --detach-process -- recording.rrd --detached-process-child. Clap treats the marker as a positional argument after --, leaving detached_process_child false, so should_relaunch_detached can recursively relaunch. Could we construct the child arguments by inserting the marker before the first --, and add a regression test for this invocation?
|
Good catch — you were right. I was appending the marker blindly, which breaks as soon as |
Related
--detach-processdoesn't work on standalone CLI (but works fine fromspawnin the SDK) #11847What
--detach-processwas copied intoStartupOptions, but that field is never read by the standalone CLI, so the viewer kept running in the invoking process.This change relaunches native-viewer CLI invocations once as a detached child:
--end-of-options separator to prevent recursion;setsidon Unix and usesDETACHED_PROCESSon Windows;Focused tests cover the one-time relaunch guard, representative native-viewer invocations,
rerun --detach-process -- recording.rrd, and the modes that must remain attached.Testing
cargo test -p rerun --lib --no-default-features --features rerun/native_viewer,rerun/run detach_(Windows and Linux; 3 passed on each)cargo clippy -p rerun --lib --no-default-features --features rerun/native_viewer,rerun/run -- --deny warnings(Windows and Linux)cargo fmt -p rerun -- --check(Windows and Linux)cargo check -p rerun --lib --tests --no-default-features --features rerun/native_viewer,rerun/run(Linux)cargo build -p rerun-cli --no-default-features --features rerun-cli/native_viewer(Linux)pixi run lint-codegenPID == SID == PGID, wrote a 124,236-byte PNG, and terminatedConfidence
High. The dead data flow was reproduced on current
main; both platform-specific paths compile, Windows and Linux process lifecycles were validated end to end, and viewer/non-viewer mode selection plus end-of-options handling have regression coverage.Agent
🤖 This PR was opened by a coding agent. The implementation and test results were reviewed in an LLM-assisted workflow.