| ... | @@ -995,12 +995,22 @@ pub const ChildProcess = struct { | ... | @@ -995,12 +995,22 @@ pub const ChildProcess = struct { |
| 995 | const path_no_ext = try fs.path.join(self.allocator, &[_][]const u8{ search_path, app_name }); | 995 | const path_no_ext = try fs.path.join(self.allocator, &[_][]const u8{ search_path, app_name }); |
| 996 | defer self.allocator.free(path_no_ext); | 996 | defer self.allocator.free(path_no_ext); |
| 997 | | 997 | |
| | 998 | const path_no_ext_w = try unicode.utf8ToUtf16LeWithNull(self.allocator, path_no_ext); |
| | 999 | defer self.allocator.free(path_no_ext_w); |
| | 1000 | |
| | 1001 | if (windowsCreateProcess(path_no_ext_w.ptr, cmd_line_w.ptr, envp_ptr, cwd_w_ptr, &siStartInfo, &piProcInfo)) |_| { |
| | 1002 | break :retry; |
| | 1003 | } else |err| switch (err) { |
| | 1004 | error.FileNotFound, error.AccessDenied => {}, |
| | 1005 | else => return err, |
| | 1006 | } |
| | 1007 | |
| 998 | var ext_it = mem.tokenize(u8, PATHEXT, ";"); | 1008 | var ext_it = mem.tokenize(u8, PATHEXT, ";"); |
| 999 | while (ext_it.next()) |app_ext| { | 1009 | while (ext_it.next()) |app_ext| { |
| 1000 | const joined_path = try mem.concat(self.allocator, u8, &[_][]const u8{ path_no_ext, app_ext }); | 1010 | const ext_w = try unicode.utf8ToUtf16LeWithNull(self.allocator, app_ext); |
| 1001 | defer self.allocator.free(joined_path); | 1011 | defer self.allocator.free(ext_w); |
| 1002 | | 1012 | |
| 1003 | const joined_path_w = try unicode.utf8ToUtf16LeWithNull(self.allocator, joined_path); | 1013 | const joined_path_w = try std.mem.concatWithSentinel(self.allocator, u16, &.{ path_no_ext_w, ext_w }, 0); |
| 1004 | defer self.allocator.free(joined_path_w); | 1014 | defer self.allocator.free(joined_path_w); |
| 1005 | | 1015 | |
| 1006 | if (windowsCreateProcess(joined_path_w.ptr, cmd_line_w.ptr, envp_ptr, cwd_w_ptr, &siStartInfo, &piProcInfo)) |_| { | 1016 | if (windowsCreateProcess(joined_path_w.ptr, cmd_line_w.ptr, envp_ptr, cwd_w_ptr, &siStartInfo, &piProcInfo)) |_| { |