From 88f0063cc44a1e23c29494f6945f5518f06b49cb Mon Sep 17 00:00:00 2001 From: utox39 Date: Thu, 6 Mar 2025 14:55:36 +0100 Subject: [PATCH] feat(linux): add shell info --- src/linux/linux.zig | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/linux/linux.zig b/src/linux/linux.zig index 322aaaa..50bc69b 100644 --- a/src/linux/linux.zig +++ b/src/linux/linux.zig @@ -53,3 +53,20 @@ pub fn getSystemUptime() !SystemUptime { .minutes = @as(i8, @intFromFloat(minutes)), }; } + +pub fn getShell(allocator: std.mem.Allocator) ![]u8 { + const shell = try std.process.getEnvVarOwned(allocator, "SHELL"); + + var child = std.process.Child.init(&[_][]const u8{ shell, "--version" }, allocator); + + child.stdout_behavior = .Pipe; + child.stderr_behavior = .Pipe; + + try child.spawn(); + + const output = try child.stdout.?.reader().readAllAlloc(allocator, 1024 * 1024); + + _ = try child.wait(); + + return output; +}