Use ShellKind::try_quote whenever we need to quote shell args (#40912)
Using `shlex` unconditionally is dangerous as it assumes the underlying shell is POSIX which is not the case for PowerShell, CMD, or Nushell. Therefore, whenever we want to quote the args we should utilise our helper `util::shell::ShellKind::try_quote` which takes into account which shell is being used to actually exec/spawn the invocation. Release Notes: - N/A --------- Co-authored-by: Lukas Wirth <me@lukaswirth.dev>
This commit is contained in:
co-authored by
Lukas Wirth
parent
18daa9a839
commit
8f4646d6c3
@@ -6,7 +6,7 @@ use gpui::AsyncApp;
|
||||
use serde_json::Value;
|
||||
use std::{path::PathBuf, sync::OnceLock};
|
||||
use task::DebugRequest;
|
||||
use util::{ResultExt, maybe};
|
||||
use util::{ResultExt, maybe, shell::ShellKind};
|
||||
|
||||
use crate::*;
|
||||
|
||||
@@ -67,7 +67,7 @@ impl JsDebugAdapter {
|
||||
.get("type")
|
||||
.filter(|value| value == &"node-terminal")?;
|
||||
let command = configuration.get("command")?.as_str()?.to_owned();
|
||||
let mut args = shlex::split(&command)?.into_iter();
|
||||
let mut args = ShellKind::Posix.split(&command)?.into_iter();
|
||||
let program = args.next()?;
|
||||
configuration.insert("runtimeExecutable".to_owned(), program.into());
|
||||
configuration.insert(
|
||||
|
||||
Reference in New Issue
Block a user