diff --git a/src/macos/system.zig b/src/macos/system.zig index f7c8857..980e8fa 100644 --- a/src/macos/system.zig +++ b/src/macos/system.zig @@ -33,7 +33,9 @@ pub fn getHostname(allocator: std.mem.Allocator) ![]u8 { } pub fn getLocale(allocator: std.mem.Allocator) ![]u8 { - const locale = try std.process.getEnvVarOwned(allocator, "LANG"); + const locale = std.process.getEnvVarOwned(allocator, "LANG") catch |err| if (err == error.EnvironmentVariableNotFound) { + return allocator.dupe(u8, "Unknown"); + } else return err; return locale; } diff --git a/src/macos/user.zig b/src/macos/user.zig index 82a8372..34abd0f 100644 --- a/src/macos/user.zig +++ b/src/macos/user.zig @@ -27,6 +27,8 @@ pub fn getShell(allocator: std.mem.Allocator) ![]u8 { } pub fn getTerminalName(allocator: std.mem.Allocator) ![]u8 { - const term_progrm = try std.process.getEnvVarOwned(allocator, "TERM_PROGRAM"); + const term_progrm = std.process.getEnvVarOwned(allocator, "TERM_PROGRAM") catch |err| if (err == error.EnvironmentVariableNotFound) { + return allocator.dupe(u8, "Unknown"); + } else return err; return term_progrm; }