diff --git a/build.zig.zon b/build.zig.zon index 7b80c84..10f9775 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -10,7 +10,7 @@ // This is a [Semantic Version](https://semver.org/). // In a future version of Zig it will be used for package deduplication. - .version = "0.8.0", + .version = "0.8.1", // Together with name, this represents a globally unique package // identifier. This field is generated by the Zig toolchain when the diff --git a/src/linux/user.zig b/src/linux/user.zig index d6bb3eb..5cd8a84 100644 --- a/src/linux/user.zig +++ b/src/linux/user.zig @@ -6,7 +6,9 @@ pub fn getUsername(allocator: std.mem.Allocator) ![]u8 { } pub fn getShell(allocator: std.mem.Allocator) ![]u8 { - const shell = try std.process.getEnvVarOwned(allocator, "SHELL"); + const shell = std.process.getEnvVarOwned(allocator, "SHELL") catch |err| if (err == error.EnvironmentVariableNotFound) { + return allocator.dupe(u8, "Unknown"); + } else return err; var child = std.process.Child.init(&[_][]const u8{ shell, "--version" }, allocator); defer allocator.free(shell); diff --git a/src/macos/user.zig b/src/macos/user.zig index 52da9fb..77c65a9 100644 --- a/src/macos/user.zig +++ b/src/macos/user.zig @@ -9,7 +9,9 @@ pub fn getUsername(allocator: std.mem.Allocator) ![]u8 { } pub fn getShell(allocator: std.mem.Allocator) ![]u8 { - const shell = try std.process.getEnvVarOwned(allocator, "SHELL"); + const shell = std.process.getEnvVarOwned(allocator, "SHELL") catch |err| if (err == error.EnvironmentVariableNotFound) { + return allocator.dupe(u8, "Unknown"); + } else return err; var child = std.process.Child.init(&[_][]const u8{ shell, "--version" }, allocator); defer allocator.free(shell);