mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-11-03 21:49:42 -09:00
Zig 0.16: env
This commit is contained in:
parent
90b590332b
commit
9b8e88c96d
2 changed files with 5 additions and 5 deletions
|
|
@ -608,10 +608,8 @@ pub fn main(init: std.process.Init) void {
|
|||
browser.loadDir(0);
|
||||
},
|
||||
.shell => {
|
||||
const shell = std.posix.getenvZ("NCDU_SHELL") orelse std.posix.getenvZ("SHELL") orelse "/bin/sh";
|
||||
var env = std.process.getEnvMap(allocator) catch unreachable;
|
||||
defer env.deinit();
|
||||
ui.runCmd(&.{shell}, browser.dir_path, &env, false);
|
||||
const shell = environ_map.get("NCDU_SHELL") orelse environ_map.get("SHELL") orelse "/bin/sh";
|
||||
ui.runCmd(&.{shell}, browser.dir_path, false);
|
||||
state = .browse;
|
||||
},
|
||||
.delete => {
|
||||
|
|
|
|||
|
|
@ -649,9 +649,11 @@ fn waitInput() void {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn runCmd(cmd: []const []const u8, cwd: ?[]const u8, env: *std.process.EnvMap, reporterr: bool) void {
|
||||
pub fn runCmd(cmd: []const []const u8, cwd: ?[]const u8, reporterr: bool) void {
|
||||
deinit();
|
||||
defer init();
|
||||
var env = main.environ_map.clone(main.allocator) catch unreachable;
|
||||
defer env.deinit();
|
||||
|
||||
// NCDU_LEVEL can only count to 9, keeps the implementation simple.
|
||||
if (env.get("NCDU_LEVEL")) |l|
|
||||
|
|
|
|||
Loading…
Reference in a new issue