fix: normalize forward slashes in paths for cmd.exe on Windows (fixes #818)#876
fix: normalize forward slashes in paths for cmd.exe on Windows (fixes #818)#876leno23 wants to merge 6 commits into
Conversation
cmd.exe treats '/' as a switch prefix, so benchmark commands like ./target/debug/foo.exe failed under the default shell while --shell=none worked. Normalize path-like tokens to backslashes before passing the command line to cmd /C. Fixes sharkdp#818 Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…p#818 branch Co-authored-by: Cursor <cursoragent@cursor.com>
shell_words::split treats backslashes as escapes and broke Windows paths in commands like `echo x >> C:\Users\...\file.log`, causing execution_order_tests to fail on Windows CI. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Pushed a fix for Windows CI: |
Co-authored-by: Cursor <cursoragent@cursor.com>
|
CI is green on all targets (including Windows after the |
|
Friendly ping — Windows forward-slash fix is CI-green on all targets. Thanks! |
|
Have you tested the form without MAX_PATH limit?
|
|
Good point — this PR only rewrites For user-supplied
I have not added a Windows CI job that constructs a real >260-character path on disk (would be environment-dependent); happy to add an integration test if you want that coverage in CI. |
Explicitly treat Win32 `\\?\` prefixes when normalizing `/` for cmd.exe, and add unit tests for forward- and backslash forms. Co-authored-by: Cursor <cursoragent@cursor.com>
f324360 to
80307d1
Compare
|
Thanks. |
Summary
cmd.exeshell treats/as a switch prefix, so commands like./target/debug/foo.exefailed while--shell=noneworked../…,../…,C:/…,*.exe, etc.) to use\before passing the command line tocmd /C.://) and non-path tokens (e.g.echo hello/world) unchanged.Test plan
util::windows_cmd(all platforms)cargo clippy -- -D warningswindows_forward_slashes_in_executable_path(CI)Closes #818
Made with Cursor