mirror of
https://github.com/nushell/nushell.git
synced 2025-08-17 04:21:20 +02:00
Replace ichwh
with which
and some fixes for auto-cd (canonicalization) (#1672)
* fix: absolutize path against its parent if it was a symlink. On Linux this happens because Rust calls readlink but doesn't canonicalize the resultant path. * feat: playground function to create symlinks * fix: use playground dirs * feat: test for #1631, shift tests names * Creation of FilesystemShell with custom location may fail * Replace ichwh with which * Creation of FilesystemShell with custom location may fail * Replace ichwh with which * fix: add ichwh again since it cannot be completely replaced * fix: replace one more use of which
This commit is contained in:
committed by
GitHub
parent
6abb9181d5
commit
c704157bc8
@ -467,12 +467,12 @@ fn spawn(
|
||||
async fn did_find_command(name: &str) -> bool {
|
||||
#[cfg(not(windows))]
|
||||
{
|
||||
ichwh::which(name).await.unwrap_or(None).is_some()
|
||||
which::which(name).is_ok()
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
{
|
||||
if ichwh::which(name).await.unwrap_or(None).is_some() {
|
||||
if which::which(name).is_ok() {
|
||||
true
|
||||
} else {
|
||||
let cmd_builtins = [
|
||||
|
@ -117,7 +117,7 @@ pub(crate) fn run_internal_command(
|
||||
}
|
||||
CommandAction::EnterShell(location) => {
|
||||
context.shell_manager.insert_at_current(Box::new(
|
||||
FilesystemShell::with_location(location, context.registry().clone()),
|
||||
FilesystemShell::with_location(location, context.registry().clone())?,
|
||||
));
|
||||
}
|
||||
CommandAction::AddAlias(name, args, block) => {
|
||||
|
@ -181,7 +181,7 @@ async fn maybe_autocd_dir<'a>(cmd: &ExternalCommand, ctx: &mut Context) -> Optio
|
||||
|| (cmd.args.is_empty()
|
||||
&& PathBuf::from(name).is_dir()
|
||||
&& dunce::canonicalize(name).is_ok()
|
||||
&& ichwh::which(&name).await.unwrap_or(None).is_none())
|
||||
&& which::which(&name).is_err())
|
||||
{
|
||||
Some(name)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user