config: return OOM instead of NoSpaceLeft for Linux fmt

This commit is contained in:
Mitchell Hashimoto
2024-09-18 07:35:31 -07:00
parent 64abbd0ea6
commit 9c897e29a4

View File

@ -3314,7 +3314,15 @@ pub const RepeatablePath = struct {
var buf: [std.fs.max_path_bytes + 1]u8 = undefined;
for (self.value.items) |item| {
const value = switch (item) {
.optional => |path| try std.fmt.bufPrint(&buf, "?{s}", .{path}),
.optional => |path| std.fmt.bufPrint(
&buf,
"?{s}",
.{path},
) catch |err| switch (err) {
// Required for builds on Linux where NoSpaceLeft
// isn't an allowed error for fmt.
error.NoSpaceLeft => return error.OutOfMemory,
},
.required => |path| path,
};