Skip to content

Commit 5cf769e

Browse files
authored
fix: improve command / noexit detection in pwsh shell config (#391)
Signed-off-by: Chapman Pendery <cpendery@vt.edu>
1 parent 01fa8ce commit 5cf769e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils/shell.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ fi`;
312312
fi`;
313313
case Shell.Powershell:
314314
case Shell.Pwsh:
315-
return `$__IsCommandFlag = ([Environment]::GetCommandLineArgs() | ForEach-Object { $_.contains("-Command") }) -contains $true
316-
$__IsNoExitFlag = ([Environment]::GetCommandLineArgs() | ForEach-Object { $_.contains("-NoExit") }) -contains $true
315+
return `$__IsCommandFlag = ([Environment]::GetCommandLineArgs() | Where-Object { $_ -imatch '^-c(ommand)?$' }).Count -gt 0
316+
$__IsNoExitFlag = ([Environment]::GetCommandLineArgs() | Where-Object { $_ -imatch '^-noe(xit)?$' }).Count -gt 0
317317
$__IsInteractive = -not $__IsCommandFlag -or ($__IsCommandFlag -and $__IsNoExitFlag)
318318
if ([string]::IsNullOrEmpty($env:ISTERM) -and [Environment]::UserInteractive -and $__IsInteractive -and [string]::IsNullOrEmpty($env:VSCODE_RESOLVING_ENVIRONMENT)) {
319319
is -s ${shell}

0 commit comments

Comments
 (0)