Skip to content

Environment variables not loaded when shell is pwsh in linux #42869

@nfriday

Description

@nfriday

Summary

Failed to load environment variables when shell is pwsh on linux.

Using zed 0.212.6 installed via NixOS unstable with pwsh as login shell:

> $env:SHELL
/run/current-system/sw/bin/pwsh

Environment variables failed to load:

2025-11-17T10:35:41+00:00 ERROR [crates/project/src/environment.rs:227] capturing shell environment with "/run/current-system/sw/bin/pwsh"

Caused by:
    login shell exited with exit status: 1. stdout: "", stderr: "\u{1b}[31;1mParserError: \u{1b}[0m\n\u{1b}[31;1m\u{1b}[36;1mLine |\u{1b}[0m\n\u{1b}[31;1m\u{1b}[36;1m\u{1b}[36;1m   1 | \u{1b}[0m … 40c4b61-zed-editor-0.212.6/libexec/.zed-editor-wrapped --printenv >\u{1b}[36;1m&\u{1b}[0m0\u{1b}[0m\n\u{1b}[31;1m\u{1b}[36;1m\u{1b}[36;1m\u{1b}[0m\u{1b}[36;1m\u{1b}[0m\u{1b}[36;1m     | \u{1b}[31;1m                                                                      ~\u{1b}[0m\n\u{1b}[31;1m\u{1b}[36;1m\u{1b}[36;1m\u{1b}[0m\u{1b}[36;1m\u{1b}[0m\u{1b}[36;1m\u{1b}[31;1m\u{1b}[31;1m\u{1b}[36;1m     | \u{1b}[31;1mMissing file specification after redirection operator.\u{1b}[0m\n"

Without the colour codes, this is:

ParserError:
Line |
   1 | … z4msjwn-zed-editor-0.211.6/libexec/.zed-editor-wrapped --printenv >&0
     |                                                                      ~
     | Missing file specification after redirection operator.

Running .zed-editor-wrapped --printenv works by itself; but the >&0 is not valid in pwsh.

If I launch zed via an existing terminal session (rather than, e.g. a launcher) it works fine.

Note: Yes, I realize how cursed using pwsh as my login shell in linux is.

Zed Version and System Specs

Zed: v0.212.6 (Zed)
OS: Linux Wayland nixos 25.05
Memory: 31.3 GiB
Architecture: x86_64
GPU: NVIDIA GeForce RTX 3070 || NVIDIA || 570.195.03

If applicable, attach your Zed.log file to this issue.

2025-11-17T10:35:41+00:00 ERROR [crates/project/src/environment.rs:227] capturing shell environment with "/run/current-system/sw/bin/pwsh"

Caused by:
    login shell exited with exit status: 1. stdout: "", stderr: "\u{1b}[31;1mParserError: \u{1b}[0m\n\u{1b}[31;1m\u{1b}[36;1mLine |\u{1b}[0m\n\u{1b}[31;1m\u{1b}[36;1m\u{1b}[36;1m   1 | \u{1b}[0m … 40c4b61-zed-editor-0.212.6/libexec/.zed-editor-wrapped --printenv >\u{1b}[36;1m&\u{1b}[0m0\u{1b}[0m\n\u{1b}[31;1m\u{1b}[36;1m\u{1b}[36;1m\u{1b}[0m\u{1b}[36;1m\u{1b}[0m\u{1b}[36;1m     | \u{1b}[31;1m                                                                      ~\u{1b}[0m\n\u{1b}[31;1m\u{1b}[36;1m\u{1b}[36;1m\u{1b}[0m\u{1b}[36;1m\u{1b}[0m\u{1b}[36;1m\u{1b}[31;1m\u{1b}[31;1m\u{1b}[36;1m     | \u{1b}[31;1mMissing file specification after redirection operator.\u{1b}[0m\n"
2025-11-17T10:35:41+00:00 ERROR [crates/project/src/environment.rs:227] capturing shell environment with "/run/current-system/sw/bin/pwsh"

Metadata

Metadata

Assignees

Labels

area:integrations/terminalFeedback for terminal integration, shell commands, etc

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions