~stacyharper/bonsai

b496d758b13685562a11f0cdd6b18f6e71d40691 — Stacy Harper 4 months ago 5025196
Avoid dangling zombie process peeking them
2 files changed, 4 insertions(+), 1 deletions(-)

M bonsai/state_machine.ha
M bonsai/type.ha
M bonsai/state_machine.ha => bonsai/state_machine.ha +2 -0
@@ 182,6 182,7 @@ export fn sync_back_wait_child(state: *state_machine, abort_it: bool) bool = {
			// it never woke up
			if (abort_it) {
				exec::kill(state.wait_pid)!;
				exec::wait(&state.wait_pid)!;
				state.wait_pid = 0;
				state.wait_pipes = void;
			};


@@ 205,6 206,7 @@ export fn sync_back_wait_child(state: *state_machine, abort_it: bool) bool = {
		};
	};

	exec::wait(&state.wait_pid)!;
	state.wait_pid = 0;

	return true;

M bonsai/type.ha => bonsai/type.ha +2 -1
@@ 1,5 1,6 @@
use fmt;
use io;
use os::exec;

export type event_name = str;



@@ 47,7 48,7 @@ export type state_machine = struct {
	all_transitions: []transition,
	available_transitions: []transition,
	context_elements: []context_element,
	wait_pid: int,
	wait_pid: exec::process,
	wait_pipes: (void | (io::file, io::file)),
};