From 0e60f1630fc6267fcaf287afef3f8c5eaafd3dd9 Mon Sep 17 00:00:00 2001 From: "John W. Trengrove" Date: Thu, 21 May 2015 22:35:05 +1000 Subject: [PATCH] switch from fork to g_spawn_async --- actiondb.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/actiondb.cc b/actiondb.cc index 6b35f47c..d76192df 100644 --- a/actiondb.cc +++ b/actiondb.cc @@ -119,14 +119,9 @@ template void StrokeInfo::serialize(Archive & ar, const unsigned using namespace std; void Command::run() { - pid_t pid = fork(); - switch (pid) { - case 0: - execlp("/bin/sh", "sh", "-c", cmd.c_str(), nullptr); - exit(1); - case -1: - printf(_("Error: can't execute command \"%s\": fork() failed\n"), cmd.c_str()); - } + gchar* argv[] = {(gchar*) "/bin/sh", (gchar*) "-c", NULL, NULL}; + argv[2] = (gchar *) cmd.c_str(); + g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL); } ButtonInfo Button::get_button_info() const {