Wait to locate system-installed Node until the shell environment is loaded (#30416)

Release Notes:

- Fixed a race condition that sometimes prevented a system-installed
`node` binary from being detected.
- Fixed a bug where the `node.path` setting was not respected when
invoking npm.
This commit is contained in:
Max Brunsfeld 2025-05-09 12:24:28 -07:00 committed by GitHub
parent 9afc6f6f5c
commit 65b13968a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 68 additions and 58 deletions

View file

@ -259,7 +259,7 @@ where
}
#[cfg(unix)]
pub fn load_shell_from_passwd() -> Result<()> {
fn load_shell_from_passwd() -> Result<()> {
let buflen = match unsafe { libc::sysconf(libc::_SC_GETPW_R_SIZE_MAX) } {
n if n < 0 => 1024,
n => n as usize,
@ -309,6 +309,8 @@ pub fn load_shell_from_passwd() -> Result<()> {
#[cfg(unix)]
pub fn load_login_shell_environment() -> Result<()> {
load_shell_from_passwd().log_err();
let marker = "ZED_LOGIN_SHELL_START";
let shell = env::var("SHELL").context(
"SHELL environment variable is not assigned so we can't source login environment variables",