std.process.Environ: fix contains function

This commit is contained in:
Andrew Kelley
2025-12-30 21:45:01 -08:00
parent 32af0f6154
commit b85524d0c8
3 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -2242,5 +2242,5 @@ pub fn unlockStderr(io: Io) void {
pub fn environ(io: Io, name: []const u8) ?[]const u8 {
_ = io;
_ = name;
if (true) @panic("TODO");
if (true) @panic("TODO Io.environ");
}
+3 -3
View File
@@ -12711,21 +12711,21 @@ fn scanEnviron(t: *Threaded) void {
fn processReplace(userdata: ?*anyopaque, options: std.process.ReplaceOptions) std.process.ReplaceError {
_ = userdata;
_ = options;
@panic("TODO");
@panic("TODO processReplace");
}
fn processReplacePath(userdata: ?*anyopaque, dir: Dir, options: std.process.ReplaceOptions) std.process.ReplaceError {
_ = userdata;
_ = dir;
_ = options;
@panic("TODO");
@panic("TODO processReplacePath");
}
fn processSpawnPath(userdata: ?*anyopaque, dir: Dir, options: process.SpawnOptions) process.SpawnError!process.Child {
_ = userdata;
_ = dir;
_ = options;
@panic("TODO");
@panic("TODO processSpawnPath");
}
const processSpawn = switch (native_os) {
+4 -3
View File
@@ -150,7 +150,7 @@ pub const Map = struct {
}
pub fn contains(m: *const Map, key: []const u8) bool {
return m.contains(key);
return m.array_hash_map.contains(key);
}
/// If there is an entry with a matching key, it is deleted from the hash
@@ -579,10 +579,11 @@ pub const CreateBlockOptions = struct {
/// Creates a null-delimited environment variable block in the format expected
/// by POSIX, from a different one.
pub fn createBlock(existing: Environ, arena: Allocator, options: CreateBlockOptions) Allocator.Error![:null]?[*:0]u8 {
const existing_block: [*:null]const ?[*:0]const u8 = @ptrCast(existing.block);
const existing_count, const contains_zig_progress = c: {
var count: usize = 0;
var contains = false;
while (existing.block[count]) |line| : (count += 1) {
while (existing_block[count]) |line| : (count += 1) {
contains = contains or mem.eql(u8, mem.sliceTo(line, '='), "ZIG_PROGRESS");
}
break :c .{ count, contains };
@@ -617,7 +618,7 @@ pub fn createBlock(existing: Environ, arena: Allocator, options: CreateBlockOpti
i += 1;
}
while (existing.block[existing_index]) |line| : (existing_index += 1) {
while (existing_block[existing_index]) |line| : (existing_index += 1) {
if (mem.eql(u8, mem.sliceTo(line, '='), "ZIG_PROGRESS")) switch (zig_progress_action) {
.add => unreachable,
.delete => continue,