X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=cli%2Fcli_diff_images.cpp;h=ba8df3e92a440afd5c29f3fafeb967559d281d2c;hb=a0708b02018902497da4df6c9be05cd053374afc;hp=626a34fc7790f4a56fb5070d81f2246c9deb72db;hpb=2ae3c962d308ceb866f7478866cdcc85f50a987d;p=apitrace diff --git a/cli/cli_diff_images.cpp b/cli/cli_diff_images.cpp index 626a34f..ba8df3e 100644 --- a/cli/cli_diff_images.cpp +++ b/cli/cli_diff_images.cpp @@ -31,14 +31,14 @@ #include "cli.hpp" #include "os_string.hpp" #include "os_process.hpp" -#include "trace_resource.hpp" +#include "cli_resources.hpp" static const char *synopsis = "Identify differences between two image dumps."; static os::String find_command(void) { - return trace::findScript("snapdiff.py"); + return findScript("snapdiff.py"); } static void @@ -49,10 +49,11 @@ usage(void) exit(1); } - char *args[3]; - args[0] = (char *) command.str(); - args[1] = (char *) "--help"; - args[2] = NULL; + char *args[4]; + args[0] = (char *) "python"; + args[1] = (char *) command.str(); + args[2] = (char *) "--help"; + args[3] = NULL; os::execute(args); } @@ -61,25 +62,21 @@ static int command(int argc, char *argv[]) { int i; - int ret; os::String command = find_command(); if (!command.length()) { return 1; } - char **args = new char* [argc + 1]; - args[0] = (char *) command.str(); + std::vector args; + args.push_back("python"); + args.push_back(command.str()); for (i = 1; i < argc; i++) { - args[i] = argv[i]; + args.push_back(argv[i]); } - args[argc] = NULL; + args.push_back(NULL); - ret = os::execute(args); - - delete [] args; - - return ret; + return os::execute((char * const *)&args[0]); } const Command diff_images_command = {