Skip to content

Commit

Permalink
Properly exit on error when -E (preprocess only) is set
Browse files Browse the repository at this point in the history
Closes Vexu#554
  • Loading branch information
squeek502 committed Nov 12, 2023
1 parent 0b0b60f commit 16b60b2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Driver.zig
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,11 @@ fn processSource(
if (d.only_preprocess) {
d.comp.renderErrors();

if (d.comp.diag.errors != 0) {
if (fast_exit) std.process.exit(1); // Not linking, no need for cleanup.
return;
}

const file = if (d.output_name) |some|
std.fs.cwd().createFile(some, .{}) catch |er|
return d.fatal("unable to create output file '{s}': {s}", .{ some, util.errorDescription(er) })
Expand Down

0 comments on commit 16b60b2

Please sign in to comment.