-
- if (this.cfg.debug) {
- stdout.printf("cd %s; %s" , this.cfg.cwd , string.joinv(" ", this.cfg.args));
- }
-
- Process.spawn_async_with_pipes (
- this.cfg.cwd,
- this.cfg.args,
- this.cfg.env,
- SpawnFlags.SEARCH_PATH | SpawnFlags.DO_NOT_REAP_CHILD,
- null,
- out this.pid,
- out standard_input,
- out standard_output,
- out standard_error);
+
+ GLib.debug("cd %s; %s" , this.cwd , string.joinv(" ", this.args));
+
+ if (this.detach) {
+ Process.spawn_async_with_pipes (
+ this.cwd,
+ this.args,
+ this.env.length > 0 ? this.env : null,
+ SpawnFlags.SEARCH_PATH | SpawnFlags.DO_NOT_REAP_CHILD,
+ null,
+ out this.pid);
+ ChildWatch.add (this.pid, (pid, status) => {
+ // Triggered when the child indicated by child_pid exits
+ Process.close_pid (pid);
+
+ });
+
+ return;
+
+ }
+ Process.spawn_async_with_pipes (
+ this.cwd,
+ this.args,
+ this.env.length > 0 ? this.env : null,
+ SpawnFlags.SEARCH_PATH | SpawnFlags.DO_NOT_REAP_CHILD,
+ null,
+ out this.pid,
+ out standard_input,
+ out standard_output,
+ out standard_error);