feat(linux): add shell info
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user