Add support for xonsh shell (#39834)
Closes #39506 Release Notes: - Fixed environment variable capture when login shell is [xonsh](https://xon.sh/) --------- Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
This commit is contained in:
@@ -46,10 +46,14 @@ async fn capture_unix(
|
||||
// See: https://github.com/zed-industries/zed/pull/32136#issuecomment-2999645482
|
||||
const FD_STDIN: std::os::fd::RawFd = 0;
|
||||
const FD_STDOUT: std::os::fd::RawFd = 1;
|
||||
const FD_STDERR: std::os::fd::RawFd = 2;
|
||||
|
||||
let (fd_num, redir) = match shell_kind {
|
||||
ShellKind::Rc => (FD_STDIN, format!(">[1={}]", FD_STDIN)), // `[1=0]`
|
||||
ShellKind::Nushell | ShellKind::Tcsh => (FD_STDOUT, "".to_string()),
|
||||
// xonsh doesn't support redirecting to stdin, and control sequences are printed to
|
||||
// stdout on startup
|
||||
ShellKind::Xonsh => (FD_STDERR, "o>e".to_string()),
|
||||
_ => (FD_STDIN, format!(">&{}", FD_STDIN)), // `>&0`
|
||||
};
|
||||
command.stdin(Stdio::null());
|
||||
@@ -133,7 +137,12 @@ async fn capture_windows(
|
||||
|
||||
let shell_kind = ShellKind::new(shell_path);
|
||||
let env_output = match shell_kind {
|
||||
ShellKind::Posix | ShellKind::Csh | ShellKind::Tcsh | ShellKind::Rc | ShellKind::Fish => {
|
||||
ShellKind::Posix
|
||||
| ShellKind::Csh
|
||||
| ShellKind::Tcsh
|
||||
| ShellKind::Rc
|
||||
| ShellKind::Fish
|
||||
| ShellKind::Xonsh => {
|
||||
return Err(anyhow::anyhow!("unsupported shell kind"));
|
||||
}
|
||||
ShellKind::PowerShell => {
|
||||
|
||||
Reference in New Issue
Block a user