#4205·wezterm

portable-pty removes custom paths from PATH on windows

Author: sigmaSdCreated Aug 27, 2023Updated Sep 29, 2026
Labelsbug

What Operating System(s) are you seeing this problem on?

Linux Wayland

Which Wayland compositor or X11 Window manager(s) are you using?

mutter

WezTerm version

wezterm 20230712-072601-f4abf8fd

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

No, and I'll explain why below

Describe the bug

I'm not familiar with power shell, so some steps I'm going to not be precise

  • on windows
  • Add a program to Path
  • run
rust
    let pair = pty_system
        .openpty(PtySize {
            rows: 24,
            cols: 80,
            pixel_width: 0,
            pixel_height: 0,
        })
        .unwrap();

    dbg!(std::process::Command::new("program").arg("--version").spawn()); // this works
    
    let mut cmd = CommandBuilder::new("program"); // this doesn't find the program
    let _child = pair.slave.spawn_command(cmd).unwrap();

the workaround is to use

rust
   let mut cmd = if cfg!(windows) {
        let mut cmd = CommandBuilder::new("deno");
        cmd.env("PATH", std::env::var("PATH").unwrap());

Repo that reproduces the problem

  • clone this repo and comment out this line https://github.com/sigmaSd/a/blob/master/src/main.rs#L19
  • push it and watch the action for windows this line dbg!(std::process::Command::new("program").arg("--version").spawn()); works but this line let mut cmd = CommandBuilder::new("program"); doesn't find the program
  • uncommenting that line back fixes the issue