aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJimmi Holst Christensen <jhc@dismail.de>2022-04-29 17:07:51 +0200
committerAndrew Kelley <andrew@ziglang.org>2022-04-29 22:50:34 -0400
commita0a2ce92ca129d28e22c63f7bace1672c43776b5 (patch)
tree26bb1adc15b8dcc3aae1e38a4d57800d7319b030 /test
parent0e49142ce478c13f3ec701900cd894b3536471a1 (diff)
downloadzig-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 'test')
-rw-r--r--test/tests.zig4
1 files changed, 1 insertions, 3 deletions
diff --git a/test/tests.zig b/test/tests.zig
index 5b15da2bcb..ee4b922021 100644
--- a/test/tests.zig
+++ b/test/tests.zig
@@ -731,9 +731,7 @@ pub const StackTracesContext = struct {
return ExecError.ExecNotSupported;
}
- const child = std.ChildProcess.init(args.items, b.allocator) catch unreachable;
- defer child.deinit();
-
+ var child = std.ChildProcess.init(args.items, b.allocator);
child.stdin_behavior = .Ignore;
child.stdout_behavior = .Pipe;
child.stderr_behavior = .Pipe;