terminal: Resolve env based on the project dir on the target (#41867)
Prior to this change we would always resolve envs when spawning a new terminal window based on the inherited CLI environment. This works fine as long as we open a new Zed instance in the terminal when using it locally only. When using Zed connected to a remote server, it would not be meaningful however. WIth this change, we correctly ping the remote for the project-local envs and use that instead. This change should also fix a pesky issue when updating Zed - after Zed restarts, opening a new terminal window will not run `direnv` for example. Release Notes: - N/A
This commit is contained in:
+13
-11
@@ -2194,21 +2194,23 @@ impl ShellExec {
|
||||
|
||||
let Some(range) = input_range else { return };
|
||||
|
||||
let Some(mut process) = project.read(cx).exec_in_shell(command, cx).log_err() else {
|
||||
return;
|
||||
};
|
||||
process.stdout(Stdio::piped());
|
||||
process.stderr(Stdio::piped());
|
||||
|
||||
if input_snapshot.is_some() {
|
||||
process.stdin(Stdio::piped());
|
||||
} else {
|
||||
process.stdin(Stdio::null());
|
||||
};
|
||||
let process_task = project.update(cx, |project, cx| project.exec_in_shell(command, cx));
|
||||
|
||||
let is_read = self.is_read;
|
||||
|
||||
let task = cx.spawn_in(window, async move |vim, cx| {
|
||||
let Some(mut process) = process_task.await.log_err() else {
|
||||
return;
|
||||
};
|
||||
process.stdout(Stdio::piped());
|
||||
process.stderr(Stdio::piped());
|
||||
|
||||
if input_snapshot.is_some() {
|
||||
process.stdin(Stdio::piped());
|
||||
} else {
|
||||
process.stdin(Stdio::null());
|
||||
};
|
||||
|
||||
let Some(mut running) = process.spawn().log_err() else {
|
||||
vim.update_in(cx, |vim, window, cx| {
|
||||
vim.cancel_running_command(window, cx);
|
||||
|
||||
Reference in New Issue
Block a user