#Spawning child within WSL does not properly propagate env vars

1 messages · Page 1 of 1 (latest)

severe mulch
#

from inside WSL, spawn a Windows process and give it env vars

const argv = &.{ python_executable, "-u", "file.py"};
    var child = std.process.Child.init(argv, allocator);
    env_map.put("PYTHONIOENCODING", "utf-8") catch |err| std.debug.panic("Failed to put PYTHONIOENCODING into env-map due to {}", .{err});
    child.env_map = &env_map;

Expected: Python process is encoded in utf-8
Actual: it is not
ideas?

thorny token
#

The WSL binfmt_misc interpreter doesn't transfer your linux env vars over to windows, I just tested it by trying to print an env var I set in linux using powershell in windows

TEST=5 pwsh.exe -Command 'Write-Host $ENV:TEST'

This just prints nothing, meaning the env var wasn't set.

severe mulch