From 5b423d1cefbfc57b9ca42218030c70fd1843e482 Mon Sep 17 00:00:00 2001 From: utox39 Date: Mon, 4 Aug 2025 00:35:09 +0200 Subject: [PATCH 1/2] feat(shell): handle 'SHELL' env var not found --- src/linux/user.zig | 4 +++- src/macos/user.zig | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) 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); From a1c62a56ae2d36df314e7c58c05f47b4e15718dd Mon Sep 17 00:00:00 2001 From: utox39 Date: Mon, 4 Aug 2025 00:38:33 +0200 Subject: [PATCH 2/2] build: bump version to 0.8.1 --- build.zig.zon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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