@@ -592,7 +592,7 @@ pub const ChildProcess = struct {
592
592
593
593
// the cwd set in ChildProcess is in effect when choosing the executable path
594
594
// to match posix semantics
595
- const app_name = x : {
595
+ const app_path = x : {
596
596
if (self .cwd ) | cwd | {
597
597
const resolved = try fs .path .resolve (self .allocator , &[_ ][]const u8 { cwd , self .argv [0 ] });
598
598
defer self .allocator .free (resolved );
@@ -601,15 +601,15 @@ pub const ChildProcess = struct {
601
601
break :x try cstr .addNullByte (self .allocator , self .argv [0 ]);
602
602
}
603
603
};
604
- defer self .allocator .free (app_name );
604
+ defer self .allocator .free (app_path );
605
605
606
- const app_name_w = try unicode .utf8ToUtf16LeWithNull (self .allocator , app_name );
607
- defer self .allocator .free (app_name_w );
606
+ const app_path_w = try unicode .utf8ToUtf16LeWithNull (self .allocator , app_path );
607
+ defer self .allocator .free (app_path_w );
608
608
609
609
const cmd_line_w = try unicode .utf8ToUtf16LeWithNull (self .allocator , cmd_line );
610
610
defer self .allocator .free (cmd_line_w );
611
611
612
- windowsCreateProcess (app_name_w .ptr , cmd_line_w .ptr , envp_ptr , cwd_w_ptr , & siStartInfo , & piProcInfo ) catch | no_path_err | {
612
+ windowsCreateProcess (app_path_w .ptr , cmd_line_w .ptr , envp_ptr , cwd_w_ptr , & siStartInfo , & piProcInfo ) catch | no_path_err | {
613
613
if (no_path_err != error .FileNotFound ) return no_path_err ;
614
614
615
615
var free_path = true ;
@@ -632,6 +632,8 @@ pub const ChildProcess = struct {
632
632
};
633
633
defer if (free_path_ext ) self .allocator .free (PATHEXT );
634
634
635
+ const app_name = self .argv [0 ];
636
+
635
637
var it = mem .tokenize (PATH , ";" );
636
638
retry : while (it .next ()) | search_path | {
637
639
const path_no_ext = try fs .path .join (self .allocator , &[_ ][]const u8 { search_path , app_name });
0 commit comments