summaryrefslogtreecommitdiffstats
path: root/source/dialogs
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-08-14 21:33:12 +0200
committerDave Davenport <qball@gmpclient.org>2017-08-14 21:33:12 +0200
commitb9ae0783c2e4e80f3d8e8f454f1197a586e14651 (patch)
tree11700ad56320e092ea8e98802ea90f4315109df3 /source/dialogs
parent8a99f0b7bd89c37c844af3307ff22d92cb584802 (diff)
[Script] Parse the command as a commandline.
Fixes: #650
Diffstat (limited to 'source/dialogs')
-rw-r--r--source/dialogs/script.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source/dialogs/script.c b/source/dialogs/script.c
index 8718b382..c58cc538 100644
--- a/source/dialogs/script.c
+++ b/source/dialogs/script.c
@@ -46,11 +46,16 @@ static char **get_script_output ( char *command, char *arg, unsigned int *length
int fd = -1;
GError *error = NULL;
char **retv = NULL;
- char *args[3] = { command, arg, NULL };
+ char **argv = NULL;
+ int argc = 0;
*length = 0;
-
- g_spawn_async_with_pipes ( NULL, args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, &fd, NULL, &error );
-
+ if ( g_shell_parse_argv ( command, &argc, &argv, &error ) )
+ {
+ argv = g_realloc ( argv, (argc+2)*sizeof(char*) );
+ argv[argc] = g_strdup(arg);
+ argv[argc+1] = NULL;
+ g_spawn_async_with_pipes ( NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, &fd, NULL, &error );
+ }
if ( error != NULL ) {
char *msg = g_strdup_printf ( "Failed to execute: '%s'\nError: '%s'", command, error->message );
rofi_view_error_dialog ( msg, FALSE );