mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
std: don't leak a process in Child.run in case of an error
Closes: #22433
This commit is contained in:
parent
c104e86442
commit
4de2b1ea65
1 changed files with 4 additions and 1 deletions
|
|
@ -428,12 +428,15 @@ pub fn run(args: struct {
|
|||
}
|
||||
|
||||
try child.spawn();
|
||||
errdefer {
|
||||
_ = child.kill() catch {};
|
||||
}
|
||||
try child.collectOutput(&stdout, &stderr, args.max_output_bytes);
|
||||
|
||||
return RunResult{
|
||||
.term = try child.wait(),
|
||||
.stdout = try stdout.toOwnedSlice(),
|
||||
.stderr = try stderr.toOwnedSlice(),
|
||||
.term = try child.wait(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue