mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
Do handle G_SPAWN_DO_NOT_REAP_CHILD after all, similarily as on Unix. If
2002-11-18 Tor Lillqvist <tml@iki.fi> * glib/gspawn-win32.c (do_spawn_with_pipes): Do handle G_SPAWN_DO_NOT_REAP_CHILD after all, similarily as on Unix. If the flag is not set, don't call DuplicateHandle() on the handle returned by the helper process, and set the "child pid" returned to the caller to zero. Close the handle to the helper process in all cases. * glib/gspawn.c (g_spawn_async_with_pipes): Document Windows behaviour of G_SPAWN_DO_NOT_REAP_CHILD.
This commit is contained in:
parent
0b4bcbe1d9
commit
a79b8073aa
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
2002-11-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/gspawn-win32.c (do_spawn_with_pipes): Do handle
|
||||
G_SPAWN_DO_NOT_REAP_CHILD after all, similarily as on Unix. If the
|
||||
flag is not set, don't call DuplicateHandle() on the handle
|
||||
returned by the helper process, and set the "child pid" returned
|
||||
to the called to zero. Close the handle to the helper process in
|
||||
all cases.
|
||||
|
||||
* glib/gspawn.c (g_spawn_async_with_pipes): Document Windows
|
||||
behaviour of G_SPAWN_DO_NOT_REAP_CHILD.
|
||||
|
||||
2002-11-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
[Win32] Fix the asynchronous g_spawn* to return the process handle
|
||||
|
@ -1,3 +1,15 @@
|
||||
2002-11-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/gspawn-win32.c (do_spawn_with_pipes): Do handle
|
||||
G_SPAWN_DO_NOT_REAP_CHILD after all, similarily as on Unix. If the
|
||||
flag is not set, don't call DuplicateHandle() on the handle
|
||||
returned by the helper process, and set the "child pid" returned
|
||||
to the called to zero. Close the handle to the helper process in
|
||||
all cases.
|
||||
|
||||
* glib/gspawn.c (g_spawn_async_with_pipes): Document Windows
|
||||
behaviour of G_SPAWN_DO_NOT_REAP_CHILD.
|
||||
|
||||
2002-11-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
[Win32] Fix the asynchronous g_spawn* to return the process handle
|
||||
|
@ -1,3 +1,15 @@
|
||||
2002-11-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/gspawn-win32.c (do_spawn_with_pipes): Do handle
|
||||
G_SPAWN_DO_NOT_REAP_CHILD after all, similarily as on Unix. If the
|
||||
flag is not set, don't call DuplicateHandle() on the handle
|
||||
returned by the helper process, and set the "child pid" returned
|
||||
to the called to zero. Close the handle to the helper process in
|
||||
all cases.
|
||||
|
||||
* glib/gspawn.c (g_spawn_async_with_pipes): Document Windows
|
||||
behaviour of G_SPAWN_DO_NOT_REAP_CHILD.
|
||||
|
||||
2002-11-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
[Win32] Fix the asynchronous g_spawn* to return the process handle
|
||||
|
@ -1,3 +1,15 @@
|
||||
2002-11-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/gspawn-win32.c (do_spawn_with_pipes): Do handle
|
||||
G_SPAWN_DO_NOT_REAP_CHILD after all, similarily as on Unix. If the
|
||||
flag is not set, don't call DuplicateHandle() on the handle
|
||||
returned by the helper process, and set the "child pid" returned
|
||||
to the called to zero. Close the handle to the helper process in
|
||||
all cases.
|
||||
|
||||
* glib/gspawn.c (g_spawn_async_with_pipes): Document Windows
|
||||
behaviour of G_SPAWN_DO_NOT_REAP_CHILD.
|
||||
|
||||
2002-11-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
[Win32] Fix the asynchronous g_spawn* to return the process handle
|
||||
|
@ -1,3 +1,15 @@
|
||||
2002-11-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/gspawn-win32.c (do_spawn_with_pipes): Do handle
|
||||
G_SPAWN_DO_NOT_REAP_CHILD after all, similarily as on Unix. If the
|
||||
flag is not set, don't call DuplicateHandle() on the handle
|
||||
returned by the helper process, and set the "child pid" returned
|
||||
to the called to zero. Close the handle to the helper process in
|
||||
all cases.
|
||||
|
||||
* glib/gspawn.c (g_spawn_async_with_pipes): Document Windows
|
||||
behaviour of G_SPAWN_DO_NOT_REAP_CHILD.
|
||||
|
||||
2002-11-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
[Win32] Fix the asynchronous g_spawn* to return the process handle
|
||||
|
@ -1,3 +1,15 @@
|
||||
2002-11-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/gspawn-win32.c (do_spawn_with_pipes): Do handle
|
||||
G_SPAWN_DO_NOT_REAP_CHILD after all, similarily as on Unix. If the
|
||||
flag is not set, don't call DuplicateHandle() on the handle
|
||||
returned by the helper process, and set the "child pid" returned
|
||||
to the called to zero. Close the handle to the helper process in
|
||||
all cases.
|
||||
|
||||
* glib/gspawn.c (g_spawn_async_with_pipes): Document Windows
|
||||
behaviour of G_SPAWN_DO_NOT_REAP_CHILD.
|
||||
|
||||
2002-11-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
[Win32] Fix the asynchronous g_spawn* to return the process handle
|
||||
|
@ -1,3 +1,15 @@
|
||||
2002-11-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/gspawn-win32.c (do_spawn_with_pipes): Do handle
|
||||
G_SPAWN_DO_NOT_REAP_CHILD after all, similarily as on Unix. If the
|
||||
flag is not set, don't call DuplicateHandle() on the handle
|
||||
returned by the helper process, and set the "child pid" returned
|
||||
to the called to zero. Close the handle to the helper process in
|
||||
all cases.
|
||||
|
||||
* glib/gspawn.c (g_spawn_async_with_pipes): Document Windows
|
||||
behaviour of G_SPAWN_DO_NOT_REAP_CHILD.
|
||||
|
||||
2002-11-18 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
[Win32] Fix the asynchronous g_spawn* to return the process handle
|
||||
|
@ -99,6 +99,7 @@ enum {
|
||||
static gboolean make_pipe (gint p[2],
|
||||
GError **error);
|
||||
static gboolean do_spawn_with_pipes (gboolean dont_wait,
|
||||
gboolean dont_return_handle,
|
||||
const gchar *working_directory,
|
||||
gchar **argv,
|
||||
gchar **envp,
|
||||
@ -254,6 +255,7 @@ g_spawn_sync (const gchar *working_directory,
|
||||
*standard_error = NULL;
|
||||
|
||||
if (!do_spawn_with_pipes (FALSE,
|
||||
TRUE,
|
||||
working_directory,
|
||||
argv,
|
||||
envp,
|
||||
@ -444,6 +446,7 @@ g_spawn_async_with_pipes (const gchar *working_directory,
|
||||
!(flags & G_SPAWN_CHILD_INHERITS_STDIN), FALSE);
|
||||
|
||||
return do_spawn_with_pipes (TRUE,
|
||||
!(flags & G_SPAWN_DO_NOT_REAP_CHILD),
|
||||
working_directory,
|
||||
argv,
|
||||
envp,
|
||||
@ -714,6 +717,7 @@ read_ints (int fd,
|
||||
|
||||
static gboolean
|
||||
do_spawn_with_pipes (gboolean dont_wait,
|
||||
gboolean dont_return_handle,
|
||||
const gchar *working_directory,
|
||||
gchar **argv,
|
||||
gchar **envp,
|
||||
@ -787,7 +791,7 @@ do_spawn_with_pipes (gboolean dont_wait,
|
||||
switch (buf[0])
|
||||
{
|
||||
case CHILD_NO_ERROR:
|
||||
if (child_pid && dont_wait)
|
||||
if (child_pid && dont_wait && !dont_return_handle)
|
||||
{
|
||||
/* helper is our HANDLE for gspawn-win32-helper. It has
|
||||
* told us the HANDLE of its child. Duplicate that into
|
||||
@ -830,6 +834,7 @@ do_spawn_with_pipes (gboolean dont_wait,
|
||||
*standard_error = stderr_pipe[0];
|
||||
if (exit_status)
|
||||
*exit_status = buf[1];
|
||||
CloseHandle ((HANDLE) helper);
|
||||
|
||||
return TRUE;
|
||||
|
||||
|
@ -437,10 +437,16 @@ g_spawn_sync (const gchar *working_directory,
|
||||
* parent's environment.
|
||||
*
|
||||
* @flags should be the bitwise OR of any flags you want to affect the
|
||||
* function's behavior. The %G_SPAWN_DO_NOT_REAP_CHILD means that the
|
||||
* child will not be automatically reaped; you must call
|
||||
* <function>waitpid()</function> or handle %SIGCHLD yourself, or the
|
||||
* child will become a zombie.
|
||||
* function's behavior. On Unix, the %G_SPAWN_DO_NOT_REAP_CHILD means
|
||||
* that the child will not be automatically reaped; you must call
|
||||
* <function>waitpid()</function> or handle %SIGCHLD yourself, or the
|
||||
* child will become a zombie. On Windows, the flag means that a
|
||||
* handle to the child will be returned @child_pid. You must call
|
||||
* <function>CloseHandle()</function> on it eventually (or exit the
|
||||
* process), or the child processs will continue to take up some table
|
||||
* space even after its death. Quite similar to zombies on Unix,
|
||||
* actually.
|
||||
*
|
||||
* %G_SPAWN_LEAVE_DESCRIPTORS_OPEN means that the parent's open file
|
||||
* descriptors will be inherited by the child; otherwise all
|
||||
* descriptors except stdin/stdout/stderr will be closed before
|
||||
@ -477,10 +483,17 @@ g_spawn_sync (const gchar *working_directory,
|
||||
* process. You should carefully consider what you do in @child_setup
|
||||
* if you intend your software to be portable to Windows.
|
||||
*
|
||||
* If non-%NULL, @child_pid will be filled with the child's process
|
||||
* ID. You can use the process ID to send signals to the child, or
|
||||
* to <function>waitpid()</function> if you specified the
|
||||
* %G_SPAWN_DO_NOT_REAP_CHILD flag.
|
||||
* If non-%NULL, @child_pid will on Unix be filled with the child's
|
||||
* process ID. You can use the process ID to send signals to the
|
||||
* child, or to <function>waitpid()</function> if you specified the
|
||||
* %G_SPAWN_DO_NOT_REAP_CHILD flag. On Windows, @child_pid will be
|
||||
* filled with a handle to the child process only if you specified the
|
||||
* %G_SPAWN_DO_NOT_REAP_CHILD flag. You can then access the child
|
||||
* process using the Win32 API, for example wait for its termination
|
||||
* with the <function>WaitFor*()</function> functions, or examine its
|
||||
* exit code with <function>GetExitCodeProcess()</function>. You
|
||||
* should close the handle with <function>CloseHandle()</function>
|
||||
* when you no longer need it.
|
||||
*
|
||||
* If non-%NULL, the @standard_input, @standard_output, @standard_error
|
||||
* locations will be filled with file descriptors for writing to the child's
|
||||
|
Loading…
Reference in New Issue
Block a user