diff options
author | 2022-07-10 15:44:57 +0200 | |
---|---|---|
committer | 2022-07-10 06:44:57 -0700 | |
commit | 16452c16da4eb0bf7ee1cbd348de06a3d2f12786 (patch) | |
tree | b7ea5b859e399b3207b5a97334164cb265e11510 /src/cli/create_command.zig | |
parent | 05970fe1fb007383438018b4b526db4ad2f22c86 (diff) | |
download | bun-16452c16da4eb0bf7ee1cbd348de06a3d2f12786.tar.gz bun-16452c16da4eb0bf7ee1cbd348de06a3d2f12786.tar.zst bun-16452c16da4eb0bf7ee1cbd348de06a3d2f12786.zip |
Remove unnecessary `Output.flush`s before `Global.exit` and `Global.crash` (#535)
* fix: add missing newline
* refactor: std.process.exit -> Global.exit
* fix: std.os.abort -> Global.exit
I'm not sure about this one. Please verify.
* cleanup: remove unnecessary `Output.flush`s
Diffstat (limited to 'src/cli/create_command.zig')
-rw-r--r-- | src/cli/create_command.zig | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/cli/create_command.zig b/src/cli/create_command.zig index fb65152cf..2a1b23e98 100644 --- a/src/cli/create_command.zig +++ b/src/cli/create_command.zig @@ -418,7 +418,6 @@ pub const CreateCommand = struct { const examples = try Example.fetchAllLocalAndRemote(ctx, null, &env_loader, filesystem); Example.print(examples.items, dirname); - Output.flush(); Global.exit(1); }, else => { @@ -532,7 +531,6 @@ pub const CreateCommand = struct { } Output.prettyErrorln("<r>\n<d>To download {s} anyway, use --force<r>", .{template}); - Output.flush(); Global.exit(1); } } @@ -571,7 +569,6 @@ pub const CreateCommand = struct { progress.refresh(); Output.prettyErrorln("<r><red>{s}<r>: opening dir {s}", .{ @errorName(err), template }); - Output.flush(); Global.exit(1); }; @@ -582,7 +579,6 @@ pub const CreateCommand = struct { progress.refresh(); Output.prettyErrorln("<r><red>{s}<r>: creating dir {s}", .{ @errorName(err), destination }); - Output.flush(); Global.exit(1); }; @@ -610,7 +606,6 @@ pub const CreateCommand = struct { progress_.refresh(); Output.prettyErrorln("<r><red>{s}<r>: copying file {s}", .{ @errorName(err), entry.path }); - Output.flush(); Global.exit(1); }; }; @@ -631,7 +626,6 @@ pub const CreateCommand = struct { progress_.refresh(); Output.prettyErrorln("<r><red>{s}<r>: copying file {s}", .{ @errorName(err), entry.path }); - Output.flush(); Global.exit(1); }; }; @@ -1876,11 +1870,9 @@ pub const Example = struct { if (content_type.len > 0) { Output.prettyErrorln("<r><red>error<r>: Unexpected content type from GitHub: {s}", .{content_type}); - Output.flush(); Global.crash(); } else { Output.prettyErrorln("<r><red>error<r>: Invalid response from GitHub (missing content type)", .{}); - Output.flush(); Global.crash(); } } @@ -1890,7 +1882,6 @@ pub const Example = struct { refresher.refresh(); Output.prettyErrorln("<r><red>error<r>: Invalid response from GitHub (missing body)", .{}); - Output.flush(); Global.crash(); } @@ -1937,11 +1928,9 @@ pub const Example = struct { } else { try ctx.log.printForLogLevelWithEnableAnsiColors(Output.errorWriter(), false); } - Output.flush(); Global.exit(1); } else { Output.prettyErrorln("Error parsing package: <r><red>{s}<r>", .{@errorName(err)}); - Output.flush(); Global.exit(1); } }; @@ -1955,7 +1944,6 @@ pub const Example = struct { } else { try ctx.log.printForLogLevelWithEnableAnsiColors(Output.errorWriter(), false); } - Output.flush(); Global.exit(1); } @@ -1974,7 +1962,6 @@ pub const Example = struct { refresher.refresh(); Output.prettyErrorln("package.json is missing tarball url. This is an internal error!", .{}); - Output.flush(); Global.exit(1); }; @@ -1999,7 +1986,6 @@ pub const Example = struct { progress.end(); refresher.refresh(); Output.prettyErrorln("Error fetching tarball: <r><red>{d}<r>", .{response.status_code}); - Output.flush(); Global.exit(1); } @@ -2026,12 +2012,10 @@ pub const Example = struct { switch (err) { error.WouldBlock => { Output.prettyErrorln("Request timed out while trying to fetch examples list. Please try again", .{}); - Output.flush(); Global.exit(1); }, else => { Output.prettyErrorln("<r><red>{s}<r> while trying to fetch examples list. Please try again", .{@errorName(err)}); - Output.flush(); Global.exit(1); }, } @@ -2039,7 +2023,6 @@ pub const Example = struct { if (response.status_code != 200) { Output.prettyErrorln("<r><red>{d}<r> fetching examples :( {s}", .{ response.status_code, mutable.list.items }); - Output.flush(); Global.exit(1); } @@ -2053,10 +2036,8 @@ pub const Example = struct { try ctx.log.printForLogLevelWithEnableAnsiColors(Output.errorWriter(), false); } Global.exit(1); - Output.flush(); } else { Output.prettyErrorln("Error parsing examples: <r><red>{s}<r>", .{@errorName(err)}); - Output.flush(); Global.exit(1); } }; @@ -2067,7 +2048,6 @@ pub const Example = struct { } else { try ctx.log.printForLogLevelWithEnableAnsiColors(Output.errorWriter(), false); } - Output.flush(); Global.exit(1); } @@ -2092,7 +2072,6 @@ pub const Example = struct { } Output.prettyErrorln("Corrupt examples data: expected object but received {s}", .{@tagName(examples_object.data)}); - Output.flush(); Global.exit(1); } }; @@ -2150,7 +2129,6 @@ const GitHandler = struct { thread = std.Thread.spawn(.{}, spawnThread, .{ destination, PATH, verbose }) catch |err| { Output.prettyErrorln("<r><red>{s}<r>", .{@errorName(err)}); - Output.flush(); Global.exit(1); }; } |