zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit e06a6b9645827fa35cfa388bbea8813206d444ad (tree)
parent 3f98756f8542e5ca6b45322f17eb59b74706fb62
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Fri, 10 Jan 2020 03:00:25 -0500

Merge pull request #4129 from daurnimator/windows-child_process

Fix windows child process creation
Diffstat:
Mlib/std/child_process.zig | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/std/child_process.zig b/lib/std/child_process.zig @@ -634,12 +634,12 @@ pub const ChildProcess = struct { var it = mem.tokenize(PATH, ";"); retry: while (it.next()) |search_path| { + const path_no_ext = try fs.path.join(self.allocator, &[_][]const u8{ search_path, app_name }); + defer self.allocator.free(path_no_ext); + var ext_it = mem.tokenize(PATHEXT, ";"); while (ext_it.next()) |app_ext| { - const app_basename = try mem.concat(self.allocator, u8, &[_][]const u8{ app_name[0 .. app_name.len - 1], app_ext }); - defer self.allocator.free(app_basename); - - const joined_path = try fs.path.join(self.allocator, &[_][]const u8{ search_path, app_basename }); + const joined_path = try mem.concat(self.allocator, u8, &[_][]const u8{ path_no_ext, app_ext }); defer self.allocator.free(joined_path); const joined_path_w = try unicode.utf8ToUtf16LeWithNull(self.allocator, joined_path);