refactor(config): use new Environ method
This commit is contained in:
1 parent
c3bbae9959
commit
9764de5353
1 file changed
+2
-3
+2
-3
@@ -3,9 +3,8 @@ const std = @import("std");
|
||||
/// Returns the current logged-in user's username.
|
||||
/// Uses the environment variable `USER`.
|
||||
/// The caller is responsible for freeing the allocated memory.
|
||||
pub fn getUsername(allocator: std.mem.Allocator) ![]u8 {
|
||||
const username = try std.process.getEnvVarOwned(allocator, "USER");
|
||||
return username;
|
||||
pub fn getUsername(allocator: std.mem.Allocator, environ: std.process.Environ) ![]u8 {
|
||||
return try std.process.Environ.getAlloc(environ, allocator, "USER");
|
||||
}
|
||||
|
||||
pub fn getShell(allocator: std.mem.Allocator) ![]u8 {
|
||||
|
||||
Reference in new issue
Block a user