test: testenv.runcommandenv, the explicit-env runcommand variant

This commit is contained in:
2026-08-08 14:35:21 +09:00
parent 3908a1557e
commit 23db361612

View File

@@ -97,10 +97,18 @@ export fn isdir(path: str) bool = {
// failures abort; termination and exit code are the caller's verdict.
export fn runcommand(dir: str, root: str, name: str, argv: []str,
lifetime: time.duration, out: *commandout) void = {
runcommandenv(dir, root, name, argv, os.getenvs(), lifetime, out);
};
// Explicit-env variant of [[runcommand]] for arranger observers that
// must control the child's environment per row (exec.command.env is
// caller-built; ww ships no setenv primitive, deliberately).
export fn runcommandenv(dir: str, root: str, name: str, argv: []str,
env: []str, lifetime: time.duration, out: *commandout) void = {
let c: exec.command;
c.path = argv[0];
c.argv = argv;
c.env = os.getenvs();
c.env = env;
c.dir = dir;
c.stdoutpath = strings.concat(root, "/", name, ".stdout");
c.stderrpath = strings.concat(root, "/", name, ".stderr");