daemon: flush deprecation warnings into the log at startup
CI / test (pull_request) Successful in 3m18s
CI / test (pull_request) Successful in 3m18s
The re-exec'd daemon inherits the buffered stderr writer over logs/zag.log from main.zig, so the deprecation warnings printed by Context.loadConfigOnce stayed in the buffer until the process exited and 'zag service logs' showed nothing right after starting with an old config. Flush stderr right after printing the warnings so they reach the log at startup, as the issue requires. e2e now starts the daemon with a config that still carries the deprecated load-level settings and asserts the warnings are in the log while the daemon is running; the settings themselves are ignored, so the effective config is unchanged for the rest of the suite.
This commit is contained in:
2 files changed
+7
-1
No files matched your search
@@ -78,6 +78,9 @@ pub const Context = struct {
|
||||
for (self.config_deprecations.items) |w| {
|
||||
self.stderr.print("warning: {s}\n", .{w}) catch {};
|
||||
}
|
||||
// The daemon's stderr is a buffered writer over logs/zag.log; flush so the
|
||||
// warnings reach the log at startup, not on process exit.
|
||||
if (self.config_deprecations.items.len > 0) self.stderr.flush() catch {};
|
||||
} else |err| {
|
||||
self.config_error = err;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user