Commit d0998d02 authored by Erik Reider's avatar Erik Reider

Fixed not being able to run multiple commands regression by #519

Thanks @jbeich for finding this bug
parent 046e895a
...@@ -358,7 +358,7 @@ namespace SwayNotificationCenter { ...@@ -358,7 +358,7 @@ namespace SwayNotificationCenter {
} }
string[] argvp; string[] argvp;
Shell.parse_argv ("/bin/sh -c %s".printf (cmd), out argvp); Shell.parse_argv ("/bin/sh -c \"%s\"".printf (cmd), out argvp);
Pid child_pid; Pid child_pid;
int std_output; int std_output;
...@@ -381,13 +381,17 @@ namespace SwayNotificationCenter { ...@@ -381,13 +381,17 @@ namespace SwayNotificationCenter {
return false; return false;
} }
try { try {
channel.read_line (out res, null, null); if (channel.read_line (out res, null, null) == IOStatus.NORMAL) {
debug ("Exec output:\n%s", res);
} else {
res = "";
}
return true; return true;
} catch (IOChannelError e) { } catch (IOChannelError e) {
stderr.printf ("stdout: IOChannelError: %s\n", e.message); warning ("stdout: IOChannelError: %s", e.message);
return false; return false;
} catch (ConvertError e) { } catch (ConvertError e) {
stderr.printf ("stdout: ConvertError: %s\n", e.message); warning ("stdout: ConvertError: %s", e.message);
return false; return false;
} }
}); });
...@@ -400,12 +404,12 @@ namespace SwayNotificationCenter { ...@@ -400,12 +404,12 @@ namespace SwayNotificationCenter {
end_status = status; end_status = status;
execute_command.callback (); execute_command.callback ();
}); });
// Waits until `run_script.callback()` is called above // Waits until `execute_command.callback()` is called above
yield; yield;
msg = res; msg = res;
return end_status == 0; return end_status == 0;
} catch (Error e) { } catch (Error e) {
stderr.printf ("Run_Script Error: %s\n", e.message); warning ("Execute Command Error: %s", e.message);
msg = e.message; msg = e.message;
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment