if (el == null)
return false;
- requests.delete_link(el);
+ --el.data.count;
+ if (el.data.count == 0)
+ requests.delete_link(el);
if (requests != null)
return false;
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(),
null,
out child_pid);
} catch (SpawnError e) {
- zavai.log.error("Running " + command + ": " + e.message);
+ zavai.log.error("Running " + script + " run: " + e.message);
return false;
}
protected void on_child(Pid pid, int status)
{
zavai.log.info("Exited");
-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;
}