New exec_command() that takes command as array instead of string

This abstracts away the details of argument quoting, which differs
between Unix and Windows.

Also replace all uses of the system() library call with exec_command().
Although system() exists on Windows, it executes the command via cmd.exe,
which has ridiculous escaping rules.
This commit is contained in:
Andrew Ayer
2014-06-10 21:21:38 -07:00
parent 0774ed018c
commit 6e43b2a1cd
5 changed files with 200 additions and 92 deletions

View File

@@ -102,12 +102,17 @@ std::string our_exe_path () // TODO
return argv0;
}
int exec_command (const char* command, std::ostream& output) // TODO
int exec_command (const std::vector<std::string>& command) // TODO
{
return -1;
}
int exec_command_with_input (const char* command, const char* p, size_t len) // TODO
int exec_command (const std::vector<std::string>& command, std::ostream& output) // TODO
{
return -1;
}
int exec_command_with_input (const std::vector<std::string>& command, const char* p, size_t len) // TODO
{
return -1;
}