From: Enrico Zini Date: Sat, 27 Mar 2010 17:00:33 +0000 (+0000) Subject: Find script for gsm X-Git-Url: https://git.toastfreeware.priv.at/gregoa/zavai.git/commitdiff_plain/ebe578b1c360938144b6083ef032f3b612abe9b0?hp=8ad05cea2433a1d99f47e5d25b2b20ccb9b70182 Find script for gsm --- diff --git a/src/core.vala b/src/core.vala index ef1363f..ade1231 100644 --- a/src/core.vala +++ b/src/core.vala @@ -219,18 +219,18 @@ public abstract class ScriptMonitorService : Service protected bool script_start() { - string command = zavai.config.homedir + "/" + name + " pre"; + string script = zavai.config.find_script(name); + zavai.log.info("Run program: " + script + " pre"); try { // Then run our own script - zavai.config.run_script(command); + zavai.config.run_script(script + " pre"); } catch (Error e) { - zavai.log.error("Running " + command + ": " + e.message); + zavai.log.error("Running " + script + " pre: " + e.message); return false; } - command = zavai.config.homedir + "/" + name + " run"; - zavai.log.info("Run program: " + command); - string[] args = command.split(" "); + zavai.log.info("Run program: " + script + " run"); + string[] args = { script, "run" }; try { Process.spawn_async( Environment.get_home_dir(), @@ -240,7 +240,7 @@ public abstract class ScriptMonitorService : Service null, out child_pid); } catch (SpawnError e) { - zavai.log.error("Running " + command + ": " + e.message); + zavai.log.error("Running " + script + " run: " + e.message); return false; } @@ -262,12 +262,11 @@ public abstract class ScriptMonitorService : Service stderr.printf("STATUS %d\n", status); Process.close_pid(pid); - string command = zavai.config.homedir + "/" + name + " post"; try { // Then run our own script - zavai.config.run_script(command); + zavai.config.find_and_run_script(name, "post"); } catch (Error e) { - zavai.log.error("Running " + command + ": " + e.message); + zavai.log.error("Running " + name + " post: " + e.message); return; }