mirror of
https://github.com/feigeCode/navop.git
synced 2026-11-06 08:07:31 +00:00
run 40680782954 里 `-p process-util --lib` 的
tests::spawn_detached_runs_child_without_blocking_caller 在 Windows 上失败:
「The filename, directory name, or volume label syntax is incorrect」后
10 秒等不到标记文件。
根因:测试把标记文件路径拼进 `cmd /C "echo done > \"C:\\...\""`。std 的
Windows 参数转义会把这条命令整体再包一层引号并把内层引号转义成 \\",而
cmd /C 的去引号规则(多于两个引号时只剥首尾)让重定向目标变成
\\C:\\...\\,路径语法错误,标记文件永远不出现。
此前没暴露是因为 cargo test --all 按 crate 名顺序执行,main 排在
process-util 之前且自 415fe13e4 起 main 的测试先挂,轮不到它跑(903a42d73
修好 main 的断言后本测试首次真正执行)。
修法:不再经 shell 重定向。标记文件预创建为子进程 stdout(Windows 上
cmd /C echo done,Unix 上 /bin/sh -c echo done),子进程直接把 done 写进
文件,命令串里不再出现任何路径,从根上绕开引号转义问题。
本地验证:
- RUSTFLAGS="-D warnings" cargo test -p process-util --lib:11 passed
- Windows 分支用 rustc --target x86_64-pc-windows-msvc 独立 snippet 类型检查通过