Opened 5 years ago
Last modified 5 years ago
#13085 new Bugs
Bad command line escaping for Windows shell
Reported by: | Owned by: | ||
---|---|---|---|
Milestone: | To Be Determined | Component: | process |
Version: | Boost 1.64.0 | Severity: | Problem |
Keywords: | Cc: |
Description
I'm trying to launch a command with the windows shell:
call "%VS140COMNTOOLS%\vsvars32.bat"
so the source is: (i have to escape the double-quotes and antislash)
std::string getCommandLine() { return "call \"%VS140COMNTOOLS%\\vsvars32.bat\"" } bp::child child(getCommandLine(), bp::shell);
The problem is that Boost is double-escaping the double-quotes, and the windows shell does not understand that:
Error: '\"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\\vsvars32.bat\"' is not recognized as an internal or external command, operable program or batch file. The problem resides here : boost/process/detail/windows/basic_cmd.hpp :35 :48 :72 I just had to comment these lines to fix the command line and spawn the shell with the correct args.
Note:
See TracTickets
for help on using tickets.
EDIT:
boost::replace_all(st, "\"", "\\\"");
boost::replace_all(arg, "\"", "\\\"");
boost::replace_all(arg, L"\"", L"\\\"");