Skip to content

Commit

Permalink
fix(powershell): fix powershell hook script override original prompt …
Browse files Browse the repository at this point in the history
…function (#101)


fix powershell hook script override original prompt function.
---------

Co-authored-by: taowong <[email protected]>
Co-authored-by: Han Li <[email protected]>
  • Loading branch information
3 people authored Mar 13, 2024
1 parent eef222d commit 9a77ef5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/shell/powershell.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ const hook = `
{{.EnvContent}}
$__VFOX_PID=$pid;
$originalPrompt = $function:prompt;
function prompt {
$export = &"{{.SelfPath}}" env -s pwsh;
if ($export) {
Invoke-Expression -Command $export;
Invoke-Expression -Command $export;
}
return "PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) ";
&$originalPrompt;
}
Register-EngineEvent -SourceIdentifier PowerShell.Exiting -SupportEvent -Action {
Expand Down

0 comments on commit 9a77ef5

Please sign in to comment.