diff options
author | José Fonseca <jose.r.fonseca@gmail.com> | 2011-11-11 14:56:42 +0000 |
---|---|---|
committer | José Fonseca <jose.r.fonseca@gmail.com> | 2011-11-11 20:14:05 +0000 |
commit | 03c5d3d41dc219051cbbb8b84ea505e15ff433c4 (patch) | |
tree | 9d21052f28cde35524cf8cdf2a57ac66435a4811 /cli | |
parent | 3984ad2eba8decfcfab3da10964746e0ef8720c7 (diff) |
Abstract execv().
Diffstat (limited to 'cli')
-rw-r--r-- | cli/cli_diff.cpp | 8 | ||||
-rw-r--r-- | cli/cli_diff_state.cpp | 22 |
2 files changed, 11 insertions, 19 deletions
diff --git a/cli/cli_diff.cpp b/cli/cli_diff.cpp index 11399a1..4d24973 100644 --- a/cli/cli_diff.cpp +++ b/cli/cli_diff.cpp @@ -30,6 +30,7 @@ #include "cli.hpp" #include "os_path.hpp" +#include "os_process.hpp" #include "trace_tools.hpp" static const char *synopsis = "Identify differences between two traces."; @@ -95,16 +96,13 @@ command(int argc, char *argv[]) #ifdef _WIN32 std::cerr << "The 'apitrace diff' command is not yet supported on this O/S.\n"; + return 1; #else os::Path apitrace = os::getProcessName(); setenv("APITRACE", apitrace.str(), 1); - execv(command.str(), args); + return os::execute(args); #endif - - std::cerr << "Error: Failed to execute " << argv[0] << "\n"; - - return 1; } const Command diff_command = { diff --git a/cli/cli_diff_state.cpp b/cli/cli_diff_state.cpp index e58bd1d..5dd0fbe 100644 --- a/cli/cli_diff_state.cpp +++ b/cli/cli_diff_state.cpp @@ -30,6 +30,7 @@ #include "cli.hpp" #include "os_path.hpp" +#include "os_process.hpp" #include "trace_tools.hpp" static const char *synopsis = "Identify differences between two state dumps."; @@ -86,22 +87,15 @@ command(int argc, char *argv[]) APITRACE_SCRIPTS_INSTALL_DIR "/" CLI_DIFF_STATE_COMMAND, true); - char* args[4]; + char *args[5]; - args[0] = (char *) command.str(); - args[1] = file1; - args[2] = file2; - args[3] = NULL; + args[0] = const_cast<char *>("python"); + args[1] = const_cast<char *>(command.str()); + args[2] = file1; + args[3] = file2; + args[4] = NULL; -#ifdef _WIN32 - std::cerr << "The 'apitrace diff-state' command is not yet supported on this O/S.\n"; -#else - execv(command.str(), args); -#endif - - std::cerr << "Error: Failed to execute " << argv[0] << "\n"; - - return 1; + return os::execute(args); } const Command diff_state_command = { |