nd: ping ngui at start as an in-process pipe test
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details

this is an attempt at identifying the underlying problem.
unclear whether this normal behaviour on a linux kernel or something to
do with zig implementation.

either way, pinging the UI makes CommReadInvalidTag error disappear on startup.

updates #16
pull/20/head v0.1.1
alex 2 years ago
parent ad8cdf727b
commit cb229d5a26
Signed by: x1ddos
GPG Key ID: FDEFB4A63CBD8460

@ -157,6 +157,11 @@ pub fn main() !void {
// TODO: thread-safety, esp. uiwriter
const uireader = ngui.stdout.?.reader();
const uiwriter = ngui.stdin.?.writer();
// send UI a ping as the first thing to make sure pipes are working.
// https://git.qcode.ch/nakamochi/ndg/issues/16
comm.write(gpa, uiwriter, .ping) catch |err| {
logger.err("comm.write ping: {any}", .{err});
};
// graceful shutdown; see sigaction(2)
const sa = os.Sigaction{
@ -191,7 +196,9 @@ pub fn main() !void {
};
logger.debug("got ui msg tagged {s}", .{@tagName(msg)});
switch (msg) {
.pong => {},
.pong => {
logger.info("received pong from ngui", .{});
},
.poweroff => {
logger.info("poweroff requested; terminating", .{});
quit = true;