[glib: 1/3] gspawn: Simplify async_with_pipes code
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/3] gspawn: Simplify async_with_pipes code
- Date: Wed, 18 May 2022 14:40:24 +0000 (UTC)
commit ac2ab3d3c661033ef06bca1e1b9f306f528b3c82
Author: Nicola Fontana <ntd entidi it>
Date: Mon May 2 10:47:55 2022 +0200
gspawn: Simplify async_with_pipes code
Be consistent with its docblock and directly call
`g_spawn_async_with_pipes_and_fds()` with the appropriate arguments.
glib/gspawn.c | 45 ++++++++++++---------------------------------
1 file changed, 12 insertions(+), 33 deletions(-)
---
diff --git a/glib/gspawn.c b/glib/gspawn.c
index 0a2cbe54ae..a4ea758c48 100644
--- a/glib/gspawn.c
+++ b/glib/gspawn.c
@@ -239,8 +239,6 @@ g_spawn_async (const gchar *working_directory,
GPid *child_pid,
GError **error)
{
- g_return_val_if_fail (argv != NULL, FALSE);
-
return g_spawn_async_with_pipes (working_directory,
argv, envp,
flags,
@@ -610,37 +608,18 @@ g_spawn_async_with_pipes (const gchar *working_directory,
gint *standard_error,
GError **error)
{
- g_return_val_if_fail (argv != NULL, FALSE);
- g_return_val_if_fail (argv[0] != NULL, FALSE);
- g_return_val_if_fail (standard_output == NULL ||
- !(flags & G_SPAWN_STDOUT_TO_DEV_NULL), FALSE);
- g_return_val_if_fail (standard_error == NULL ||
- !(flags & G_SPAWN_STDERR_TO_DEV_NULL), FALSE);
- /* can't inherit stdin if we have an input pipe. */
- g_return_val_if_fail (standard_input == NULL ||
- !(flags & G_SPAWN_CHILD_INHERITS_STDIN), FALSE);
-
- return fork_exec (!(flags & G_SPAWN_DO_NOT_REAP_CHILD),
- working_directory,
- (const gchar * const *) argv,
- (const gchar * const *) envp,
- !(flags & G_SPAWN_LEAVE_DESCRIPTORS_OPEN),
- (flags & G_SPAWN_SEARCH_PATH) != 0,
- (flags & G_SPAWN_SEARCH_PATH_FROM_ENVP) != 0,
- (flags & G_SPAWN_STDOUT_TO_DEV_NULL) != 0,
- (flags & G_SPAWN_STDERR_TO_DEV_NULL) != 0,
- (flags & G_SPAWN_CHILD_INHERITS_STDIN) != 0,
- (flags & G_SPAWN_FILE_AND_ARGV_ZERO) != 0,
- (flags & G_SPAWN_CLOEXEC_PIPES) != 0,
- child_setup,
- user_data,
- child_pid,
- standard_input,
- standard_output,
- standard_error,
- -1, -1, -1,
- NULL, NULL, 0,
- error);
+ return g_spawn_async_with_pipes_and_fds (working_directory,
+ (const gchar * const *) argv,
+ (const gchar * const *) envp,
+ flags,
+ child_setup, user_data,
+ -1, -1, -1,
+ NULL, NULL, 0,
+ child_pid,
+ standard_input,
+ standard_output,
+ standard_error,
+ error);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]