From 51229335baf62fdeb4dc23389133901c9e3afe80 Mon Sep 17 00:00:00 2001 From: Sergey Chadov Date: Sun, 31 Aug 2014 14:34:15 +0400 Subject: [PATCH] win32 fix --- src/shell.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/shell.cpp b/src/shell.cpp index e12fe31..6d51020 100644 --- a/src/shell.cpp +++ b/src/shell.cpp @@ -1,5 +1,6 @@ #include #include +#include #ifdef _WIN32 @@ -30,10 +31,13 @@ int exec(const char* command) { ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); ZeroMemory(&pi, sizeof(pi)); - + + int command_len = strlen(command); + std::vector command_copy(&command[0], &command[command_len]); + // Start the child process. if(!CreateProcess(NULL, // No module name (use command line) - (LPSTR) command,// Command line + (LPSTR) &command_copy[0],// Command line NULL, // Process handle not inheritable NULL, // Thread handle not inheritable FALSE, // Set handle inheritance to FALSE