[easytag] Use GSubprocess instead of g_spawn_async()
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Use GSubprocess instead of g_spawn_async()
- Date: Sun, 5 Mar 2017 18:27:28 +0000 (UTC)
commit 99d5b3bb227a42fa314d4d8cad9b6994c82d9f63
Author: David King <amigadave amigadave com>
Date: Mon Jan 30 18:09:24 2017 +0000
Use GSubprocess instead of g_spawn_async()
src/misc.c | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/src/misc.c b/src/misc.c
index 89cbafa..6d21dd2 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -140,12 +140,6 @@ gboolean Add_String_To_Combo_List (GtkListStore *liststore, const gchar *str)
#endif
}
-static void
-et_on_child_exited (GPid pid, gint status, gpointer user_data)
-{
- g_spawn_close_pid (pid);
-}
-
/*
* Run a program with a list of parameters
* - args_list : list of filename (with path)
@@ -160,8 +154,8 @@ et_run_program (const gchar *program_name,
gchar **program_args_argv = NULL;
guint n_program_args = 0;
gsize i;
- GPid pid;
gchar **argv;
+ GSubprocess *subprocess;
GList *l;
gchar *program_path;
gboolean res = FALSE;
@@ -252,13 +246,12 @@ et_run_program (const gchar *program_name,
argv[i] = NULL;
/* Execution ... */
- if (g_spawn_async (NULL, argv, NULL,
- G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
- NULL, NULL, &pid, error))
+ if ((subprocess = g_subprocess_newv ((const gchar * const *)argv,
+ G_SUBPROCESS_FLAGS_NONE, error)))
{
- g_child_watch_add (pid, et_on_child_exited, NULL);
-
res = TRUE;
+ /* There is no need to watch to see if the child process exited. */
+ g_object_unref (subprocess);
}
g_strfreev (program_args_argv);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]