project environment: Log when which env is used (#19270)

This adds more logging for debugging purposes.

Release Notes:

- N/A
This commit is contained in:
Thorsten Ball 2024-10-16 14:12:45 +02:00 committed by GitHub
parent 109ebc5f27
commit 2f960c4aba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -112,8 +112,18 @@ impl ProjectEnvironment {
let worktree = worktree_id.zip(worktree_abs_path);
let cli_environment = self.get_cli_environment();
if cli_environment.is_some() {
Task::ready(cli_environment)
if let Some(environment) = cli_environment {
cx.spawn(|_, _| async move {
let path = environment
.get("PATH")
.map(|path| path.as_str())
.unwrap_or_default();
log::info!(
"using project environment variables from CLI. PATH={:?}",
path
);
Some(environment)
})
} else if let Some((worktree_id, worktree_abs_path)) = worktree {
self.get_worktree_env(worktree_id, worktree_abs_path, cx)
} else {
@ -143,6 +153,15 @@ impl ProjectEnvironment {
.await;
if let Some(shell_env) = shell_env.as_mut() {
let path = shell_env
.get("PATH")
.map(|path| path.as_str())
.unwrap_or_default();
log::info!(
"using project environment variables shell launched in {:?}. PATH={:?}",
worktree_abs_path,
path
);
this.update(&mut cx, |this, _| {
this.cached_shell_environments
.insert(worktree_id, shell_env.clone());