diff --git a/lib/std/child_process.zig b/lib/std/child_process.zig index 7cf0f4681a..e051ea532e 100644 --- a/lib/std/child_process.zig +++ b/lib/std/child_process.zig @@ -530,7 +530,7 @@ pub const ChildProcess = struct { // can fail between fork() and execve(). // Therefore, we do all the allocation for the execve() before the fork(). // This means we must do the null-termination of argv and env vars here. - const argv_buf = try arena.allocSentinel(?[*:0]u8, self.argv.len, null); + const argv_buf = try arena.allocSentinel(?[*:0]const u8, self.argv.len, null); for (self.argv, 0..) |arg, i| argv_buf[i] = (try arena.dupeZ(u8, arg)).ptr; const envp = m: { @@ -542,7 +542,7 @@ pub const ChildProcess = struct { } else if (builtin.output_mode == .Exe) { // Then we have Zig start code and this works. // TODO type-safety for null-termination of `os.environ`. - break :m @ptrCast([*:null]?[*:0]u8, os.environ.ptr); + break :m @ptrCast([*:null]?[*:0]const u8, os.environ.ptr); } else { // TODO come up with a solution for this. @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) ! return try allocator.realloc(result, i); } -pub fn createNullDelimitedEnvMap(arena: mem.Allocator, env_map: *const EnvMap) ![:null]?[*:0]u8 { +pub fn createNullDelimitedEnvMap(arena: mem.Allocator, env_map: *const EnvMap) ![:null]?[*:0]const u8 { const envp_count = env_map.count(); - const envp_buf = try arena.allocSentinel(?[*:0]u8, envp_count, null); + const envp_buf = try arena.allocSentinel(?[*:0]const u8, envp_count, null); { var it = env_map.iterator(); var i: usize = 0;