mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-14 19:55:12 +01:00
Merge branch 'gsubprocess-test-fix' into 'master'
tests: Fix small race in GSubprocess tests See merge request GNOME/glib!883
This commit is contained in:
commit
645dcc232c
@ -749,6 +749,11 @@ g_subprocess_newv (const gchar * const *argv,
|
||||
*
|
||||
* On UNIX, returns the process ID as a decimal string.
|
||||
* On Windows, returns the result of GetProcessId() also as a string.
|
||||
* If the subprocess has terminated, this will return %NULL.
|
||||
*
|
||||
* Returns: (nullable): the subprocess identifier, or %NULL if the subprocess
|
||||
* has terminated
|
||||
* Since: 2.40
|
||||
*/
|
||||
const gchar *
|
||||
g_subprocess_get_identifier (GSubprocess *subprocess)
|
||||
|
@ -66,14 +66,11 @@ test_noop (void)
|
||||
GError **error = &local_error;
|
||||
GPtrArray *args;
|
||||
GSubprocess *proc;
|
||||
const gchar *id;
|
||||
|
||||
args = get_test_subprocess_args ("noop", NULL);
|
||||
proc = g_subprocess_newv ((const gchar * const *) args->pdata, G_SUBPROCESS_FLAGS_NONE, error);
|
||||
g_ptr_array_free (args, TRUE);
|
||||
g_assert_no_error (local_error);
|
||||
id = g_subprocess_get_identifier (proc);
|
||||
g_assert_nonnull (id);
|
||||
|
||||
g_subprocess_wait_check (proc, NULL, error);
|
||||
g_assert_no_error (local_error);
|
||||
@ -1297,12 +1294,16 @@ test_terminate (void)
|
||||
GSubprocess *proc;
|
||||
GPtrArray *args;
|
||||
GMainLoop *loop;
|
||||
const gchar *id;
|
||||
|
||||
args = get_test_subprocess_args ("sleep-forever", NULL);
|
||||
proc = g_subprocess_newv ((const gchar * const *) args->pdata, G_SUBPROCESS_FLAGS_NONE, error);
|
||||
g_ptr_array_free (args, TRUE);
|
||||
g_assert_no_error (local_error);
|
||||
|
||||
id = g_subprocess_get_identifier (proc);
|
||||
g_assert_nonnull (id);
|
||||
|
||||
loop = g_main_loop_new (NULL, TRUE);
|
||||
|
||||
g_subprocess_wait_async (proc, NULL, on_request_quit_exited, loop);
|
||||
|
Loading…
x
Reference in New Issue
Block a user