[gnome-commander/gcmd-1-4] Migrated from gnome_execute_shell to g_spawn_async, fixes bgo#571495
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/gcmd-1-4] Migrated from gnome_execute_shell to g_spawn_async, fixes bgo#571495
- Date: Sun, 5 Oct 2014 19:47:38 +0000 (UTC)
commit 4847712a23deec617ac1c6394b986b90dc980a5d
Author: Uwe Scholz <uwescholz src gnome org>
Date: Sun Oct 5 21:13:47 2014 +0200
Migrated from gnome_execute_shell to g_spawn_async, fixes bgo#571495
src/utils.cc | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/utils.cc b/src/utils.cc
index 926b939..453f9a0 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -95,7 +95,15 @@ void DEBUG (gchar flag, const gchar *format, ...)
}
-void run_command_indir (const gchar *in_command, const gchar *dir, gboolean term)
+/**
+ * This function executes a command in the active directory in a
+ * terminal window, if desired.
+ * \param in_command Command to be executed.
+ * \param dpath Directory in which the command should be executed.
+ * \param term If TRUE, the command is executed in a terminal window.
+ * \sa GnomeCmdData::Options::termexec
+ */
+void run_command_indir (const gchar *in_command, const gchar *dpath, gboolean term)
{
gchar *command;
@@ -120,8 +128,16 @@ void run_command_indir (const gchar *in_command, const gchar *dir, gboolean term
command = g_strdup (in_command);
DEBUG ('g', "running%s: %s\n", (term?" in terminal":""), command);
+
+ gint argc;
+ gchar **argv;
+ GError *error = NULL;
+
+ g_shell_parse_argv (command, &argc, &argv, NULL);
+ if (!g_spawn_async (dpath, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error))
+ gnome_cmd_error_message (_("Unable to execute command."), error);
- gnome_execute_shell (dir, command);
+ g_strfreev (argv);
g_free (command);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]