Skip to content

Commit ee31390

Browse files
committed
CompileCheck: unlock stderr before panic
1 parent 94acbdb commit ee31390

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

CompileCheck.zig

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -264,20 +264,22 @@ fn getGeneratedFilePath(compile: *std.Build.Step.Compile, comptime tag_name: []c
264264
const maybe_path: ?*std.Build.GeneratedFile = @field(compile, tag_name);
265265

266266
const generated_file = maybe_path orelse {
267-
std.debug.lockStdErr();
268-
const stderr = std.io.getStdErr();
269-
270-
std.Build.dumpBadGetPathHelp(&compile.step, stderr, compile.step.owner, asking_step) catch {};
271-
267+
{
268+
std.debug.lockStdErr();
269+
defer std.debug.unlockStdErr();
270+
const stderr = std.io.getStdErr();
271+
std.Build.dumpBadGetPathHelp(&compile.step, stderr, compile.step.owner, asking_step) catch {};
272+
}
272273
@panic("missing emit option for " ++ tag_name);
273274
};
274275

275276
const path = generated_file.path orelse {
276-
std.debug.lockStdErr();
277-
const stderr = std.io.getStdErr();
278-
279-
std.Build.dumpBadGetPathHelp(&compile.step, stderr, compile.step.owner, asking_step) catch {};
280-
277+
{
278+
std.debug.lockStdErr();
279+
defer std.debug.unlockStdErr();
280+
const stderr = std.io.getStdErr();
281+
std.Build.dumpBadGetPathHelp(&compile.step, stderr, compile.step.owner, asking_step) catch {};
282+
}
281283
@panic(tag_name ++ " is null. Is there a missing step dependency?");
282284
};
283285

0 commit comments

Comments
 (0)