fixed bug #1509909 - !system & !packhdr fail with quotes

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4711 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2006-07-30 10:29:23 +00:00
parent e4432fd8e1
commit b15cf04ef2
4 changed files with 31 additions and 2 deletions

View file

@ -692,3 +692,30 @@ string lowercase(const string &str) {
transform(str.begin(), str.end(), result.begin(), tolower);
return result;
}
int sane_system(const char *command) {
#ifdef _WIN32
// workaround for bug #1509909
// http://sf.net/tracker/?func=detail&atid=373085&aid=1509909&group_id=22049
//
// cmd.exe /C has some weird handling for quotes. it strips
// the surrounding quotes, if they exist. if there are quotes
// around the program path and its arguments, it will strip
// the outer quotes. this may result in something like:
// `program files\nsis\makensis.exe" "args`
// which obviously fails...
//
// to avoid the stripping, a harmless string is prefixed
// to the command line.
string command_s = "IF 1==1 ";
command_s += command;
return system(command_s.c_str());
#else
return system(command);
#endif
}