From fb8a299765a884bbd260b6c544687da2e9aee3f3 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Fri, 29 Mar 2024 12:21:09 -0700 Subject: [PATCH] shell: windows: make EnvMap case-insensitive (#9704) * shell: windows: make EnvMap case-insensitive * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- src/shell/interpreter.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/shell/interpreter.zig b/src/shell/interpreter.zig index a7564623234a0..c56fb76dc0bbb 100644 --- a/src/shell/interpreter.zig +++ b/src/shell/interpreter.zig @@ -509,11 +509,17 @@ pub const EnvMap = struct { const MapType = std.ArrayHashMap(EnvStr, EnvStr, struct { pub fn hash(self: @This(), s: EnvStr) u32 { _ = self; + if (bun.Environment.isWindows) { + return bun.CaseInsensitiveASCIIStringContext.hash(undefined, s.slice()); + } return std.array_hash_map.hashString(s.slice()); } pub fn eql(self: @This(), a: EnvStr, b: EnvStr, b_index: usize) bool { _ = self; _ = b_index; + if (bun.Environment.isWindows) { + return bun.CaseInsensitiveASCIIStringContext.eql(undefined, a.slice(), b.slice(), undefined); + } return std.array_hash_map.eqlString(a.slice(), b.slice()); } }, true);