Forbid std::process::Command spawning, replace with smol where appropriate (#38894)
std commands can block for an arbitrary duration and so runs risk of blocking tasks for too long. This replaces all such uses where sensible with async processes. Release Notes: - N/A *or* Added/Fixed/Improved ...
This commit is contained in:
@@ -249,7 +249,7 @@ async fn load_shell_environment(
|
||||
use util::shell_env;
|
||||
|
||||
let dir_ = dir.to_owned();
|
||||
let mut envs = match smol::unblock(move || shell_env::capture(&dir_)).await {
|
||||
let mut envs = match shell_env::capture(&dir_).await {
|
||||
Ok(envs) => envs,
|
||||
Err(err) => {
|
||||
util::log_err(&err);
|
||||
|
||||
@@ -1407,7 +1407,7 @@ impl GitStore {
|
||||
GitStoreState::Local { fs, .. } => {
|
||||
let fs = fs.clone();
|
||||
cx.background_executor()
|
||||
.spawn(async move { fs.git_init(&path, fallback_branch_name) })
|
||||
.spawn(async move { fs.git_init(&path, fallback_branch_name).await })
|
||||
}
|
||||
GitStoreState::Remote {
|
||||
upstream_client,
|
||||
|
||||
@@ -470,7 +470,7 @@ impl Project {
|
||||
TerminalSettings::get(settings_location, cx)
|
||||
}
|
||||
|
||||
pub fn exec_in_shell(&self, command: String, cx: &App) -> Result<std::process::Command> {
|
||||
pub fn exec_in_shell(&self, command: String, cx: &App) -> Result<smol::process::Command> {
|
||||
let path = self.first_project_directory(cx);
|
||||
let remote_client = self.remote_client.as_ref();
|
||||
let settings = self.terminal_settings(&path, cx).clone();
|
||||
@@ -508,6 +508,10 @@ impl Project {
|
||||
Ok(command)
|
||||
}
|
||||
}
|
||||
.map(|mut process| {
|
||||
util::set_pre_exec_to_start_new_session(&mut process);
|
||||
smol::process::Command::from(process)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn local_terminal_handles(&self) -> &Vec<WeakEntity<terminal::Terminal>> {
|
||||
|
||||
Reference in New Issue
Block a user