[geany/geany] 5c893e: Windows: fix spawning commands with spaces

Colomban Wendling git-noreply at xxxxx
Wed Feb 19 14:53:25 UTC 2014


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Wed, 19 Feb 2014 14:53:25 UTC
Commit:      5c893e9b0eac95cc26f35a5dc279872ff1588f27
             https://github.com/geany/geany/commit/5c893e9b0eac95cc26f35a5dc279872ff1588f27

Log Message:
-----------
Windows: fix spawning commands with spaces

Fix spawnning command under Windows when they contain spaces in both
the executable and the arguments.  Apparently system() quoting is
unexpected, and doesn't work properly if there is more than 2 quotes
in the whole command.

To work this around, spawn the command through `cmd.exe /S /C`.


Modified Paths:
--------------
    src/win32.c

Modified: src/win32.c
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -1050,7 +1050,7 @@ gboolean win32_spawn(const gchar *dir, gchar **argv, gchar **env, GSpawnFlags fl
 		return FALSE;
 	}
 	command = g_strjoinv(" ", argv);
-	SETPTR(command, g_strdup_printf("%s >%s 2>%s",
+	SETPTR(command, g_strdup_printf("cmd.exe /S /C \"%s >%s 2>%s\"",
 		command, tmp_file, tmp_errfile));
 	g_chdir(dir);
 	ret = system(command);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list