X-Git-Url: https://git.toastfreeware.priv.at/gregoa/zavai.git/blobdiff_plain/753ba864e402ad6c261d122400c4a0dc2f8ab237..2410d1cba02872da361ad86086176867a19df0b0:/src/app.vala diff --git a/src/app.vala b/src/app.vala index 6366b6a..5281f56 100644 --- a/src/app.vala +++ b/src/app.vala @@ -158,6 +158,37 @@ public class Zavai : Gtk.Window, zavai.Resource show_all(); } } + + public void run_script(string command) + { + zavai.log.info("Run program: " + command); + string[] args = command.split(" "); + Pid pid; + try { + Process.spawn_async( + Environment.get_home_dir(), + args, + null, + SpawnFlags.SEARCH_PATH, + null, + out pid); + } catch (SpawnError e) { + zavai.log.error("Running " + command + ": " + e.message); + } + } + + public int run_script_sync(string command, out string std_out, out string std_err) + { + int status = -1; + zavai.log.info("Run program: " + command); + string[] args = command.split(" "); + try { + bool res = Process.spawn_sync(Environment.get_home_dir(), args, null, SpawnFlags.SEARCH_PATH, null, out std_out, out std_err, out status); + } catch (SpawnError e) { + zavai.log.error("Running " + command + ": " + e.message); + } + return status; + } } public abstract class Applet : Gtk.VBox, Resource