History

Load env vars from login shell in remote server (#40148)

Fixes a bug mentioned in https://github.com/zed-industries/zed/issues/38891 Release Notes: - Fixed a bug where environment variables like `NODE_EXTRA_CA_CERTS` were not loaded from the user's shell initialization scripts in WSL or SSH remote projects.

Max Brunsfeld committed 1 year ago

Commit 6a2bad41 parent ad4a53c1 file · +14 −2Browse files

Unified · Split

crates/remote_server/src/unix.rs+14−2
@@ -6,7 +6,7 @@ use util::ResultExt; · 5 unmodified lines
66
77 use extension::ExtensionHostProxy;
88 use fs::{Fs, RealFs};
9−use futures::channel::mpsc;
9+use futures::channel::{mpsc, oneshot};
1010 use futures::{AsyncRead, AsyncWrite, AsyncWriteExt, FutureExt, SinkExt, select, select_biased};
1111 use git::GitHostingProviderRegistry;
1212 use gpui::{App, AppContext as _, Context, Entity, SemanticVersion, UpdateGlobal as _};
@@ -368,6 +368,14 @@ pub fn execute_run( · 355 unmodified lines
368368
369369 let listeners = ServerListeners::new(stdin_socket, stdout_socket, stderr_socket)?;
370370
371+ let (shell_env_loaded_tx, shell_env_loaded_rx) = oneshot::channel();
372+ app.background_executor()
373+ .spawn(async {
374+ util::load_login_shell_environment().await.log_err();
375+ shell_env_loaded_tx.send(()).ok();
376+ })
377+ .detach();
378+
371379 let git_hosting_provider_registry = Arc::new(GitHostingProviderRegistry::new());
372380 app.run(move |cx| {
373381 settings::init(cx);
@@ -413,7 +421,11 @@ pub fn execute_run( · 39 unmodified lines
413421 )
414422 };
415423
416− let node_runtime = NodeRuntime::new(http_client.clone(), None, node_settings_rx);
424+ let node_runtime = NodeRuntime::new(
425+ http_client.clone(),
426+ Some(shell_env_loaded_rx),
427+ node_settings_rx,
428+ );
417429
418430 let mut languages = LanguageRegistry::new(cx.background_executor().clone());
419431 languages.set_language_server_download_dir(paths::languages_dir().clone());

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t