From a9faace8b4c9b2bef9425c4cdb136ff8fec056b8 Mon Sep 17 00:00:00 2001 From: Sahnvour Date: Tue, 5 Feb 2019 22:44:14 +0100 Subject: [PATCH 1/2] Notify failure to create a process when the executable is not found even in PATH. --- std/os/child_process.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/std/os/child_process.zig b/std/os/child_process.zig index 7aa8582369..37f75483a6 100644 --- a/std/os/child_process.zig +++ b/std/os/child_process.zig @@ -610,6 +610,9 @@ pub const ChildProcess = struct { } else { return err; } + } else { + // Every other error would have been returned earlier. + return error.FileNotFound; } }; From 6860db66fed86de6cea57134c12374905abac8d8 Mon Sep 17 00:00:00 2001 From: Sahnvour Date: Tue, 5 Feb 2019 23:13:17 +0100 Subject: [PATCH 2/2] Typo: use the joined path to try executables available from PATH. --- std/os/child_process.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/std/os/child_process.zig b/std/os/child_process.zig index 37f75483a6..871f9dd701 100644 --- a/std/os/child_process.zig +++ b/std/os/child_process.zig @@ -600,7 +600,7 @@ pub const ChildProcess = struct { const joined_path = try os.path.join(self.allocator, search_path, app_name); defer self.allocator.free(joined_path); - const joined_path_w = try unicode.utf8ToUtf16LeWithNull(self.allocator, app_name); + const joined_path_w = try unicode.utf8ToUtf16LeWithNull(self.allocator, joined_path); defer self.allocator.free(joined_path_w); if (windowsCreateProcess(joined_path_w.ptr, cmd_line_w.ptr, envp_ptr, cwd_w_ptr, &siStartInfo, &piProcInfo)) |_| {