Skip to content
Snippets Groups Projects
Commit 6a36758c authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

allow double quote escaping in -watch string to prevent shell expansion

parent 2aeaa427
No related branches found
No related tags found
No related merge requests found
...@@ -233,8 +233,13 @@ void GetOptions(int argc, char *argv[]) ...@@ -233,8 +233,13 @@ void GetOptions(int argc, char *argv[])
} }
else if(!strcmp(argv[i] + 1, "watch")) { else if(!strcmp(argv[i] + 1, "watch")) {
i++; i++;
if(argv[i]) if(argv[i]){
CTX::instance()->watchFilePattern = argv[i++]; std::string tmp = argv[i++];
if(tmp.size() > 2 && tmp[0] == '"' && tmp[tmp.size() - 1] == '"')
CTX::instance()->watchFilePattern = tmp.substr(1, tmp.size() - 2);
else
CTX::instance()->watchFilePattern = tmp;
}
else else
Msg::Fatal("Missing string"); Msg::Fatal("Missing string");
} }
......
...@@ -97,7 +97,7 @@ StringXString GeneralOptions_String[] = { ...@@ -97,7 +97,7 @@ StringXString GeneralOptions_String[] = {
#endif #endif
"System command to launch a web browser" }, "System command to launch a web browser" },
{ F|S, "WatchFilePattern", opt_general_watch_file_pattern , "" , { F|0, "WatchFilePattern", opt_general_watch_file_pattern , "" ,
"Pattern of files to watch out for (to load automatically)"}, "Pattern of files to watch out for (to load automatically)"},
{ 0, 0 , 0 , "" , 0 } { 0, 0 , 0 , "" , 0 }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment