Skip to content

Commit

Permalink
os.exit -> process.exit
Browse files Browse the repository at this point in the history
  • Loading branch information
squeek502 committed Mar 28, 2024
1 parent ee70640 commit f8f0b4b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn main() !void {
var options = cli.parse(allocator, args, &cli_diagnostics) catch |err| switch (err) {
error.ParseError => {
cli_diagnostics.renderToStdErr(args, stderr_config);
std.os.exit(1);
std.process.exit(1);
},
else => |e| return e,
};
Expand Down Expand Up @@ -93,7 +93,7 @@ pub fn main() !void {
},
}
try renderErrorMessage(stderr.writer(), stderr_config, .note, "to disable auto includes, use the option /:auto-includes none", .{});
std.os.exit(1);
std.process.exit(1);
},
};

Expand Down Expand Up @@ -131,18 +131,18 @@ pub fn main() !void {
// extra newline to separate this line from the aro errors
try renderErrorMessage(stderr.writer(), stderr_config, .err, "failed during preprocessor setup (this is always a bug):\n", .{});
aro.Diagnostics.render(&comp, stderr_config);
std.os.exit(1);
std.process.exit(1);
},
// ArgError can occur if e.g. the .rc file is not found
error.ArgError, error.PreprocessError => {
// extra newline to separate this line from the aro errors
try renderErrorMessage(stderr.writer(), stderr_config, .err, "failed during preprocessing:\n", .{});
aro.Diagnostics.render(&comp, stderr_config);
std.os.exit(1);
std.process.exit(1);
},
error.StreamTooLong => {
try renderErrorMessage(stderr.writer(), stderr_config, .err, "failed during preprocessing: maximum file size exceeded", .{});
std.os.exit(1);
std.process.exit(1);
},
error.OutOfMemory => |e| return e,
};
Expand All @@ -151,7 +151,7 @@ pub fn main() !void {
} else {
break :full_input std.fs.cwd().readFileAlloc(allocator, options.input_filename, std.math.maxInt(usize)) catch |err| {
try renderErrorMessage(stderr.writer(), stderr_config, .err, "unable to read input file path '{s}': {s}", .{ options.input_filename, @errorName(err) });
std.os.exit(1);
std.process.exit(1);
};
}
};
Expand All @@ -171,14 +171,14 @@ pub fn main() !void {
const final_input = removeComments(mapping_results.result, mapping_results.result, &mapping_results.mappings) catch |err| switch (err) {
error.InvalidSourceMappingCollapse => {
try renderErrorMessage(stderr.writer(), stderr_config, .err, "failed during comment removal; this is a known bug", .{});
std.os.exit(1);
std.process.exit(1);
},
else => |e| return e,
};

var output_file = std.fs.cwd().createFile(options.output_filename, .{}) catch |err| {
try renderErrorMessage(stderr.writer(), stderr_config, .err, "unable to create output file '{s}': {s}", .{ options.output_filename, @errorName(err) });
std.os.exit(1);
std.process.exit(1);
};
var output_file_closed = false;
defer if (!output_file_closed) output_file.close();
Expand Down Expand Up @@ -240,7 +240,7 @@ pub fn main() !void {
output_file_closed = true;
// Failing to delete is not really a big deal, so swallow any errors
std.fs.cwd().deleteFile(options.output_filename) catch {};
std.os.exit(1);
std.process.exit(1);
},
else => |e| return e,
};
Expand All @@ -262,7 +262,7 @@ pub fn main() !void {
if (options.depfile_path) |depfile_path| {
var depfile = std.fs.cwd().createFile(depfile_path, .{}) catch |err| {
try renderErrorMessage(stderr.writer(), stderr_config, .err, "unable to create depfile '{s}': {s}", .{ depfile_path, @errorName(err) });
std.os.exit(1);
std.process.exit(1);
};
defer depfile.close();

Expand Down

0 comments on commit f8f0b4b

Please sign in to comment.