diff options
| author | Jimmi Holst Christensen <jhc@dismail.de> | 2022-04-29 17:07:51 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-04-29 22:50:34 -0400 |
| commit | a0a2ce92ca129d28e22c63f7bace1672c43776b5 (patch) | |
| tree | 26bb1adc15b8dcc3aae1e38a4d57800d7319b030 /src/mingw.zig | |
| parent | 0e49142ce478c13f3ec701900cd894b3536471a1 (diff) | |
| download | zig-a0a2ce92ca129d28e22c63f7bace1672c43776b5.tar.gz zig-a0a2ce92ca129d28e22c63f7bace1672c43776b5.zip | |
std: Do not allocate the result for ChildProcess.init
Instead, just return ChildProcess directly. This structure does not
require a stable address, so we can put it on the stack just fine. If
someone wants it on the heap they should do.
const proc = try allocator.create(ChildProcess);
proc.* = ChildProcess.init(args, allocator);
Diffstat (limited to 'src/mingw.zig')
| -rw-r--r-- | src/mingw.zig | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/mingw.zig b/src/mingw.zig index 84ec0795f1..e99a1af8fc 100644 --- a/src/mingw.zig +++ b/src/mingw.zig @@ -369,9 +369,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { } if (std.process.can_spawn) { - const child = try std.ChildProcess.init(&args, arena); - defer child.deinit(); - + var child = std.ChildProcess.init(&args, arena); child.stdin_behavior = .Ignore; child.stdout_behavior = .Pipe; child.stderr_behavior = .Pipe; |
