]> git.lizzy.rs Git - rust.git/commit
std: Fix process spawn for arguments ending in backslashes on Windows
authorBrad King <brad.king@kitware.com>
Sat, 25 Apr 2015 19:35:22 +0000 (15:35 -0400)
committerBrad King <brad.king@kitware.com>
Sat, 25 Apr 2015 19:35:22 +0000 (15:35 -0400)
commite90408e91596da9fd81e77012e74bfe94b26dd83
tree92918899558e44f3fab15c05ae03a10eca7e0f15
parent83263b48c39ef0e21cc9872191f4ce4877f4e05f
std: Fix process spawn for arguments ending in backslashes on Windows

Fix `make_command_line` for the case of backslashes at the end of an
argument requiring quotes.  We must encode the command and arguments
such that `CommandLineToArgvW` recovers them in the spawned process.
Simplify the logic by using a running count of backslashes as they
are encountered instead of looking ahead for quotes following them.

Extend `test_make_command_line` to additionally cover:

* a leading quote in an argument that requires quotes,
* a backslash before a quote in an argument that requires quotes,
* a backslash at the end of an argument that requires quotes, and
* a backslash at the end of an argument that does not require quotes.
src/libstd/sys/windows/process2.rs