[geany/geany] 01612a: Merge pull request #536 from zhekov/spawn

Colomban Wendling git-noreply at xxxxx
Sat Jun 27 12:33:11 UTC 2015


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sat, 27 Jun 2015 12:33:11 UTC
Commit:      01612a9505cd3671e6b5d899454b098cfae28d0a
             https://github.com/geany/geany/commit/01612a9505cd3671e6b5d899454b098cfae28d0a

Log Message:
-----------
Merge pull request #536 from zhekov/spawn

Spawn fixes/improvements


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

Modified: src/spawn.c
19 lines changed, 7 insertions(+), 12 deletions(-)
===================================================================
@@ -59,6 +59,7 @@
 
 #ifdef SPAWN_TEST
 # define _
+# define GEANY_API_SYMBOL
 #else
 # include "support.h"
 #endif
@@ -360,7 +361,11 @@ static gchar *spawn_create_process_with_pipes(char *command_line, const char *wo
 	{
 		failed = NULL;
 		CloseHandle(process.hThread);  /* we don't need this */
-		*hprocess = process.hProcess;
+
+		if (hprocess)
+			*hprocess = process.hProcess;
+		else
+			CloseHandle(process.hProcess);
 	}
 
 leave:
@@ -444,12 +449,6 @@ static void spawn_append_argument(GString *command, const char *text)
 		g_string_append_c(command, '"');
 	}
 }
-
-
-static void spawn_close_pid(GPid pid, G_GNUC_UNUSED gint status, G_GNUC_UNUSED gpointer data)
-{
-	g_spawn_close_pid(pid);
-}
 #endif /* G_OS_WIN32 */
 
 
@@ -491,7 +490,6 @@ gboolean spawn_async_with_pipes(const gchar *working_directory, const gchar *com
 #ifdef G_OS_WIN32
 	GString *command;
 	GArray *environment;
-	GPid pid;
 	gchar *failure;
 
 	if (command_line)
@@ -539,8 +537,7 @@ gboolean spawn_async_with_pipes(const gchar *working_directory, const gchar *com
 	}
 
 	failure = spawn_create_process_with_pipes(command->str, working_directory,
-		envp ? environment->data : NULL, child_pid ? child_pid : &pid,
-		stdin_fd, stdout_fd, stderr_fd);
+		envp ? environment->data : NULL, child_pid, stdin_fd, stdout_fd, stderr_fd);
 
 	g_string_free(command, TRUE);
 	g_array_free(environment, TRUE);
@@ -551,8 +548,6 @@ gboolean spawn_async_with_pipes(const gchar *working_directory, const gchar *com
 		g_free(failure);
 		return FALSE;
 	}
-	else if (!child_pid)
-		g_child_watch_add(pid, spawn_close_pid, NULL);
 
 	return TRUE;
 #else  /* G_OS_WIN32 */



--------------
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