Skip to content

Commit 5ca9797

Browse files
committed
fix: pass shell hints from eval wrappers
1 parent 7a3ed1c commit 5ca9797

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

  • crates/vite_global_cli/src/commands/env

crates/vite_global_cli/src/commands/env/setup.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,8 @@ function vp
530530
command vp $argv; return
531531
end
532532
set -lx VP_ENV_USE_EVAL_ENABLE 1
533-
set -l __vp_out (env FISH_VERSION=$FISH_VERSION __VP_BIN__/vp $argv); or return $status
533+
set -lx VP_SHELL fish
534+
set -l __vp_out (command vp $argv); or return $status
534535
eval (string join ';' $__vp_out)
535536
else
536537
command vp $argv
@@ -562,7 +563,7 @@ def --env --wrapped vp [...args: string@"nu-complete vp"] {
562563
^vp ...$args
563564
return
564565
}
565-
let out = (with-env { VP_ENV_USE_EVAL_ENABLE: "1" } {
566+
let out = (with-env { VP_ENV_USE_EVAL_ENABLE: "1", VP_SHELL: "nu" } {
566567
^vp ...$args
567568
})
568569
let lines = ($out | lines)
@@ -625,6 +626,7 @@ function vp {
625626
& (Join-Path $__vp_bin "vp") @args; return
626627
}
627628
$env:VP_ENV_USE_EVAL_ENABLE = "1"
629+
$env:VP_SHELL = "pwsh"
628630
$output = & (Join-Path $__vp_bin "vp") @args 2>&1 | ForEach-Object {
629631
if ($_ -is [System.Management.Automation.ErrorRecord]) {
630632
Write-Host $_.Exception.Message
@@ -633,6 +635,7 @@ function vp {
633635
}
634636
}
635637
Remove-Item Env:VP_ENV_USE_EVAL_ENABLE -ErrorAction SilentlyContinue
638+
Remove-Item Env:VP_SHELL -ErrorAction SilentlyContinue
636639
if ($LASTEXITCODE -eq 0 -and $output) {
637640
Invoke-Expression ($output -join "`n")
638641
}
@@ -1031,10 +1034,6 @@ mod tests {
10311034
fish_content.contains("\"$argv[2]\" = \"use\""),
10321035
"env.fish should check for 'use' subcommand"
10331036
);
1034-
assert!(
1035-
fish_content.contains("/vp $argv"),
1036-
"env.fish should use absolute path to vp for passthrough"
1037-
);
10381037
}
10391038

10401039
#[tokio::test]

0 commit comments

Comments
 (0)