refactor(macos): handle the EnvironmentVariableNotFound error for the env vars 'LANG' and 'TERM_PROGRAM'
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user