authorgravatar for xavierb@gmail.comXavier Bouchoux <xavierb@gmail.com> 2023-07-10 19:04:10+00:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-11 00:17:08-07:00
log7a8002a5cf8e6607c1a2bfbd12fec3e60390fc71
tree6a05097ab20158a0f52afbfa85f9283fe3c6daaf
parentdbc560904aa5570648709cb392204f25884dddd8

remove arbitrary stderr size limit when spawning a child process tool


5 files changed, 5 insertions(+), 10 deletions(-)

src/Compilation.zig+1-3
...@@ -4067,9 +4067,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P...@@ -4067,9 +4067,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P
40674067
4068 try child.spawn();4068 try child.spawn();
40694069
4070 const stderr_reader = child.stderr.?.reader();4070 const stderr = try child.stderr.?.reader().readAllAlloc(arena, std.math.maxInt(usize));
4071
4072 const stderr = try stderr_reader.readAllAlloc(arena, 10 * 1024 * 1024);
40734071
4074 const term = child.wait() catch |err| {4072 const term = child.wait() catch |err| {
4075 return comp.failCObj(c_object, "unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });4073 return comp.failCObj(c_object, "unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });
src/link/Coff/lld.zig+1-1
...@@ -545,7 +545,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod...@@ -545,7 +545,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
545545
546 try child.spawn();546 try child.spawn();
547547
548 const stderr = try child.stderr.?.reader().readAllAlloc(arena, 10 * 1024 * 1024);548 const stderr = try child.stderr.?.reader().readAllAlloc(arena, std.math.maxInt(usize));
549549
550 const term = child.wait() catch |err| {550 const term = child.wait() catch |err| {
551 log.err("unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });551 log.err("unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });
src/link/Elf.zig+1-1
...@@ -1949,7 +1949,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v...@@ -1949,7 +1949,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v
19491949
1950 try child.spawn();1950 try child.spawn();
19511951
1952 const stderr = try child.stderr.?.reader().readAllAlloc(arena, 10 * 1024 * 1024);1952 const stderr = try child.stderr.?.reader().readAllAlloc(arena, std.math.maxInt(usize));
19531953
1954 const term = child.wait() catch |err| {1954 const term = child.wait() catch |err| {
1955 log.err("unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });1955 log.err("unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });
src/link/Wasm.zig+1-1
...@@ -4529,7 +4529,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !...@@ -4529,7 +4529,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !
45294529
4530 try child.spawn();4530 try child.spawn();
45314531
4532 const stderr = try child.stderr.?.reader().readAllAlloc(arena, 10 * 1024 * 1024);4532 const stderr = try child.stderr.?.reader().readAllAlloc(arena, std.math.maxInt(usize));
45334533
4534 const term = child.wait() catch |err| {4534 const term = child.wait() catch |err| {
4535 log.err("unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });4535 log.err("unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });
src/mingw.zig+1-4
...@@ -379,10 +379,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void {...@@ -379,10 +379,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void {
379379
380 try child.spawn();380 try child.spawn();
381381
382 const stderr_reader = child.stderr.?.reader();382 const stderr = try child.stderr.?.reader().readAllAlloc(arena, std.math.maxInt(usize));
383
384 // TODO https://github.com/ziglang/zig/issues/6343
385 const stderr = try stderr_reader.readAllAlloc(arena, 10 * 1024 * 1024);
386383
387 const term = child.wait() catch |err| {384 const term = child.wait() catch |err| {
388 // TODO surface a proper error here385 // TODO surface a proper error here