Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Wed, 19 Feb 2014 15:15:52 UTC Commit: 26d2ef8d99c6c66796d7ab8b4a09aa230c9905ac https://github.com/geany/geany/commit/26d2ef8d99c6c66796d7ab8b4a09aa230c9905...
Log Message: ----------- Merge branch 'win32-quote-spawn-args'
Closes bug #943 and PR #180.
Modified Paths: -------------- src/win32.c
Modified: src/win32.c 11 files changed, 9 insertions(+), 2 deletions(-) =================================================================== @@ -1038,6 +1038,7 @@ gboolean win32_spawn(const gchar *dir, gchar **argv, gchar **env, GSpawnFlags fl gchar *tmp_file = create_temp_file(); gchar *tmp_errfile = create_temp_file(); gchar *command; + gchar *locale_command;
if (env != NULL) { @@ -1050,10 +1051,15 @@ 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)); + locale_command = g_locale_from_utf8(command, -1, NULL, NULL, NULL); + if (! locale_command) + locale_command = g_strdup(command); + geany_debug("WIN32: actually running command:\n%s", command); g_chdir(dir); - ret = system(command); + errno = 0; + ret = system(locale_command); /* the command can return -1 as an exit code, so check errno also */ fail = ret == -1 && errno; if (!fail) @@ -1067,6 +1073,7 @@ gboolean win32_spawn(const gchar *dir, gchar **argv, gchar **env, GSpawnFlags fl g_set_error_literal(error, G_SPAWN_ERROR, errno, g_strerror(errno));
g_free(command); + g_free(locale_command); g_unlink(tmp_file); g_free(tmp_file); g_unlink(tmp_errfile);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).