diff options
author | 2022-02-11 14:56:28 -0800 | |
---|---|---|
committer | 2022-02-11 14:56:28 -0800 | |
commit | 3d057950b9249bed3c5b0034ef7424ac84adf2e5 (patch) | |
tree | d2f64bbf42890191711571708f110e79990880b2 /misctools/fetch.zig | |
parent | 29f0159eae198aebf5ff9d2b6f76ddbdb2f8f63c (diff) | |
download | bun-3d057950b9249bed3c5b0034ef7424ac84adf2e5.tar.gz bun-3d057950b9249bed3c5b0034ef7424ac84adf2e5.tar.zst bun-3d057950b9249bed3c5b0034ef7424ac84adf2e5.zip |
`std.os.`exit -> `Global.exit` so stderr is always flushed
Diffstat (limited to '')
-rw-r--r-- | misctools/fetch.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/misctools/fetch.zig b/misctools/fetch.zig index 2167429e0..f8c06be5d 100644 --- a/misctools/fetch.zig +++ b/misctools/fetch.zig @@ -96,7 +96,7 @@ pub const Arguments = struct { if (args.flag("--version")) { try Output.writer().writeAll(VERSION); - std.os.exit(0); + Global.exit(0); } var method = Method.GET; @@ -116,13 +116,13 @@ pub const Arguments = struct { var body_file = std.fs.openFileAbsoluteZ(absolute_path_, .{ .read = true }) catch |err| { Output.printErrorln("<r><red>{s}<r> opening file {s}", .{ @errorName(err), absolute_path }); Output.flush(); - std.os.exit(1); + Global.exit(1); }; var file_contents = body_file.readToEndAlloc(allocator, try body_file.getEndPos()) catch |err| { Output.printErrorln("<r><red>{s}<r> reading file {s}", .{ @errorName(err), absolute_path }); Output.flush(); - std.os.exit(1); + Global.exit(1); }; body_string = file_contents; } @@ -141,7 +141,7 @@ pub const Arguments = struct { if (raw_args.items.len == 0) { Output.prettyErrorln("<r><red>error<r><d>:<r> <b>Missing URL<r>\n\nExample:\n<r><b>fetch GET https://example.com<r>\n\n<b>fetch example.com/foo<r>\n\n", .{}); Output.flush(); - std.os.exit(1); + Global.exit(1); } const url_position = raw_args.items.len - 1; @@ -149,7 +149,7 @@ pub const Arguments = struct { if (!url.isAbsolute()) { Output.prettyErrorln("<r><red>error<r><d>:<r> <b>Invalid URL<r>\n\nExample:\n<r><b>fetch GET https://example.com<r>\n\n<b>fetch example.com/foo<r>\n\n", .{}); Output.flush(); - std.os.exit(1); + Global.exit(1); } } @@ -218,7 +218,7 @@ pub fn main() anyerror!void { var response = http.response orelse { Output.prettyErrorln("<r><red>error<r><d>:<r> <b>HTTP response missing<r>", .{}); Output.flush(); - std.os.exit(1); + Global.exit(1); }; switch (response.status_code) { |