new plan for process supervision
All checks were successful
AWS-Zig Build / build-zig-0.11.0-amd64-host (push) Successful in 1m36s

This commit is contained in:
Emil Lerch 2023-10-25 17:34:15 -07:00
parent 8227857563
commit 9941e0cebb
Signed by: lobo
GPG Key ID: A7B62D657EF764F8

View File

@ -48,13 +48,16 @@ fn runStandaloneServerParent(allocator: ?std.mem.Allocator, event_handler: inter
try al.append(a);
}
// Parent
var cp = std.ChildProcess.init(al.items, aa);
cp.stdin = std.io.getStdIn();
cp.stdout = std.io.getStdOut();
cp.stderr = std.io.getStdErr();
const stdin = std.io.getStdIn();
const stdout = std.io.getStdOut();
const stderr = std.io.getStdErr();
while (true) {
var cp = std.ChildProcess.init(al.items, aa);
cp.stdin = stdin;
cp.stdout = stdout;
cp.stderr = stderr;
_ = try cp.spawnAndWait();
try cp.stderr.?.writeAll("Caught abnormal process termination, relaunching server");
try stderr.writeAll("Caught abnormal process termination, relaunching server");
}
}