mirror of
https://github.com/AGWA/git-crypt.git
synced 2026-01-16 06:53:01 -08:00
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:
6
util.hpp
6
util.hpp
@@ -36,6 +36,7 @@
|
||||
#include <iosfwd>
|
||||
#include <stdint.h>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
struct System_error {
|
||||
std::string action;
|
||||
@@ -58,8 +59,9 @@ public:
|
||||
|
||||
void mkdir_parent (const std::string& path); // Create parent directories of path, __but not path itself__
|
||||
std::string our_exe_path ();
|
||||
int exec_command (const char* command, std::ostream& output);
|
||||
int exec_command_with_input (const char* command, const char* p, size_t len);
|
||||
int exec_command (const std::vector<std::string>&);
|
||||
int exec_command (const std::vector<std::string>&, std::ostream& output);
|
||||
int exec_command_with_input (const std::vector<std::string>&, const char* p, size_t len);
|
||||
bool successful_exit (int status);
|
||||
std::string escape_shell_arg (const std::string&);
|
||||
uint32_t load_be32 (const unsigned char*);
|
||||
|
||||
Reference in New Issue
Block a user