Skip to content

Commit 0b8f698

Browse files
committed
fix: version not shown due to not flushed
1 parent 23b00a5 commit 0b8f698

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/cli.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ pub const Cli = union(enum) {
8888
} else if (streql(cmd, "info")) {
8989
command = Cli.show;
9090
} else if (streql(cmd, "-h") or streql(cmd, "--help")) {
91-
utils.printStdOut("{s}\n", .{helptext});
91+
try utils.printStdOut("{s}\n", .{helptext});
9292
std.process.exit(0);
9393
} else if (streql(cmd, "-V") or streql(cmd, "--version")) {
94-
utils.printStdOut("{s}\n", .{Version});
94+
try utils.printStdOut("{s}\n", .{Version});
9595
std.process.exit(0);
9696
} else if (streql(cmd, "update-self")) {
9797
command = Cli.update_self;

src/utils.zig

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,13 @@ pub inline fn is_valid_arch_os(arch: ?[]const u8, os: ?[]const u8) bool {
7272
return result;
7373
}
7474

75-
pub fn printStdOut(comptime fmt: []const u8, args: anytype) void {
75+
pub fn printStdOut(comptime fmt: []const u8, args: anytype) std.Io.Writer.Error!void {
7676
var buf: [1024]u8 = undefined;
77-
var writer = std.fs.File.stdout().writer(&buf);
77+
var stdout = std.fs.File.stdout();
78+
var writer = stdout.writer(&buf);
7879
const intf = &writer.interface;
79-
nosuspend intf.print(fmt, args) catch return;
80+
nosuspend try intf.print(fmt, args);
81+
try intf.flush();
8082
}
8183

8284
pub fn make_request(client: *Client, uri: std.Uri) ?Client.Request {

0 commit comments

Comments
 (0)