[aot] Wrap the commands we pass to Windows's system() in double quotes.
authorJoão Matos <joao@tritao.eu>
Fri, 13 Mar 2015 17:14:40 +0000 (17:14 +0000)
committerJoão Matos <joao@tritao.eu>
Fri, 13 Mar 2015 17:14:40 +0000 (17:14 +0000)
We need an extra set of quotes around the whole command to properly handle commands
with spaces since internally the command is called through "cmd /c.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=27899.

mono/mini/aot-compiler.c

index 7ba888a577718874cec9ab75c6b2579e4d086a73..1504923e47fbbff899858a83933c3738cce5fb5e 100644 (file)
@@ -7163,11 +7163,17 @@ execute_system (const char * command)
        int status;
 
 #if _WIN32
+       // We need an extra set of quotes around the whole command to properly handle commands 
+       // with spaces since internally the command is called through "cmd /c.
+       command = g_strdup_printf ("\"%s\"", command);
+
        int size =  MultiByteToWideChar (CP_UTF8, 0 , command , -1, NULL , 0);
        wchar_t* wstr = g_malloc (sizeof (wchar_t) * size);
        MultiByteToWideChar (CP_UTF8, 0, command, -1, wstr , size);
        status = _wsystem (wstr);
        g_free (wstr);
+
+       g_free (command);
 #else
        status = system (command);
 #endif