| ... | @@ -530,7 +530,7 @@ pub const ChildProcess = struct { | ... | @@ -530,7 +530,7 @@ pub const ChildProcess = struct { |
| 530 | // can fail between fork() and execve(). | 530 | // can fail between fork() and execve(). |
| 531 | // Therefore, we do all the allocation for the execve() before the fork(). | 531 | // Therefore, we do all the allocation for the execve() before the fork(). |
| 532 | // This means we must do the null-termination of argv and env vars here. | 532 | // This means we must do the null-termination of argv and env vars here. |
| 533 | const argv_buf = try arena.allocSentinel(?[*:0]u8, self.argv.len, null); | 533 | const argv_buf = try arena.allocSentinel(?[*:0]const u8, self.argv.len, null); |
| 534 | for (self.argv, 0..) |arg, i| argv_buf[i] = (try arena.dupeZ(u8, arg)).ptr; | 534 | for (self.argv, 0..) |arg, i| argv_buf[i] = (try arena.dupeZ(u8, arg)).ptr; |
| 535 | | 535 | |
| 536 | const envp = m: { | 536 | const envp = m: { |
| ... | @@ -542,7 +542,7 @@ pub const ChildProcess = struct { | ... | @@ -542,7 +542,7 @@ pub const ChildProcess = struct { |
| 542 | } else if (builtin.output_mode == .Exe) { | 542 | } else if (builtin.output_mode == .Exe) { |
| 543 | // Then we have Zig start code and this works. | 543 | // Then we have Zig start code and this works. |
| 544 | // TODO type-safety for null-termination of `os.environ`. | 544 | // TODO type-safety for null-termination of `os.environ`. |
| 545 | break :m @ptrCast([*:null]?[*:0]u8, os.environ.ptr); | 545 | break :m @ptrCast([*:null]?[*:0]const u8, os.environ.ptr); |
| 546 | } else { | 546 | } else { |
| 547 | // TODO come up with a solution for this. | 547 | // TODO come up with a solution for this. |
| 548 | @compileError("missing std lib enhancement: ChildProcess implementation has no way to collect the environment variables to forward to the child process"); | 548 | @compileError("missing std lib enhancement: ChildProcess implementation has no way to collect the environment variables to forward to the child process"); |
| ... | @@ -1425,9 +1425,9 @@ pub fn createWindowsEnvBlock(allocator: mem.Allocator, env_map: *const EnvMap) ! | ... | @@ -1425,9 +1425,9 @@ pub fn createWindowsEnvBlock(allocator: mem.Allocator, env_map: *const EnvMap) ! |
| 1425 | return try allocator.realloc(result, i); | 1425 | return try allocator.realloc(result, i); |
| 1426 | } | 1426 | } |
| 1427 | | 1427 | |
| 1428 | pub fn createNullDelimitedEnvMap(arena: mem.Allocator, env_map: *const EnvMap) ![:null]?[*:0]u8 { | 1428 | pub fn createNullDelimitedEnvMap(arena: mem.Allocator, env_map: *const EnvMap) ![:null]?[*:0]const u8 { |
| 1429 | const envp_count = env_map.count(); | 1429 | const envp_count = env_map.count(); |
| 1430 | const envp_buf = try arena.allocSentinel(?[*:0]u8, envp_count, null); | 1430 | const envp_buf = try arena.allocSentinel(?[*:0]const u8, envp_count, null); |
| 1431 | { | 1431 | { |
| 1432 | var it = env_map.iterator(); | 1432 | var it = env_map.iterator(); |
| 1433 | var i: usize = 0; | 1433 | var i: usize = 0; |