Skip to content

Commit

Permalink
🐛 Add -NoNewWindow to Start-Process in Show-Karma -Meditat (#397)
Browse files Browse the repository at this point in the history
* 🐛 (#395) Add -NoNewWindow

Start-Process by default opens a new console. We generally do not want
this to be the case for Show-Karma -Meditate.

* ✅ Update test to expect new param
  • Loading branch information
vexx32 committed Jun 14, 2020
1 parent f81479b commit 247dcc1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion PSKoans/Public/Show-Karma.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function Show-Karma {
}

if ($Editor -and (Get-Command -Name $Editor -ErrorAction SilentlyContinue)) {
Start-Process -FilePath $Editor -ArgumentList $Arguments
Start-Process -FilePath $Editor -ArgumentList $Arguments -NoNewWindow
}
else {
Invoke-Item -Path $FilePath
Expand Down
3 changes: 2 additions & 1 deletion Tests/Functions/Public/Show-Karma.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ Describe 'Show-Karma' {
Mock Get-Command { $true } -ParameterFilter { $Name -ne "missing_editor" }
Mock Get-Command { $false } -ParameterFilter { $Name -eq "missing_editor" }
Mock Start-Process {
@{ Editor = $FilePath; Arguments = $ArgumentList }
@{ Editor = $FilePath; Arguments = $ArgumentList; NoNewWindow = $NoNewWindow }
}
Mock Get-Karma -ModuleName 'PSKoans' {
$script:CurrentTopic = @{
Expand Down Expand Up @@ -267,6 +267,7 @@ Describe 'Show-Karma' {
$Result.Arguments[0] | Should -BeExactly '--goto'
$Result.Arguments[1] | Should -MatchExactly '"[^"]+":\d+'
$Result.Arguments[2] | Should -BeExactly '--reuse-window'
$Result.NoNewWindow | Should -BeTrue

# Resolve-Path doesn't like embedded quotes
$Path = ($Result.Arguments[1] -split '(?<="):')[0] -replace '"'
Expand Down

0 comments on commit 247dcc1

Please sign in to comment.