Browse Source

Fixed use of backslash in process commands.

merge-requests/365/head
U-olece-PC\olece 10 years ago
parent
commit
aff1640691
  1. 12
      src/process_win.cpp

12
src/process_win.cpp

@ -98,10 +98,6 @@ Process::id_type Process::open(const std::string &command, const std::string &pa
#ifdef MSYS_PROCESS_USE_SH
size_t pos=0;
std::string sh_command=command;
while((pos=sh_command.find('\\', pos))!=std::string::npos) {
sh_command.replace(pos, 1, "\\\\\\");
pos+=3;
}
while((pos=sh_command.find('\"', pos))!=std::string::npos) {
if(pos>0 && sh_command[pos-1]!='\\') {
sh_command.replace(pos, 1, "\\\"");
@ -109,6 +105,14 @@ Process::id_type Process::open(const std::string &command, const std::string &pa
}
pos++;
}
pos=0;
while((pos=sh_command.find('\\', pos))!=std::string::npos) {
if((pos+1)==sh_command.size() || sh_command[pos+1]!='\"') {
sh_command.replace(pos, 1, "\\\\\\");
pos++;
}
pos+=2;
}
sh_command.insert(0, "sh -c \"");
sh_command+="\"";
command_cstr=new char[sh_command.size()+1];

Loading…
Cancel
Save