Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion PSKoans/Private/Invoke-Koan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
}
}

$ps = [powershell]::Create($script:KoanRunspace)
$ps = [powershell]::Create()
$ps.Runspace = $script:KoanRunspace
$ps.AddScript($Script, <# useLocalScope: #> $true) > $null

$ps.AddParameter('Params', $ParameterSplat) > $null
Expand Down
3 changes: 2 additions & 1 deletion PSKoans/Private/New-KoanRunspace.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
[CmdletBinding()]
param()

$runspace = [runspacefactory]::CreateRunspace()

Check warning on line 22 in PSKoans/Private/New-KoanRunspace.ps1

View workflow job for this annotation

GitHub Actions / ci / Run Linters

Unknown word (runspacefactory)
$runspace.Open()
$runspace.Name = 'PSKoans.KoanRunspace'
$ps = [powershell]::Create($runspace)
$ps = [powershell]::Create()
$ps.Runspace = $runspace

try {
$script = {
Expand Down
3 changes: 2 additions & 1 deletion tests/Functions/Private/New-KoanRunspace.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
# Run the build in a child process -- build.ps1 calls `exit` on completion, which
# would otherwise terminate the host process running this test file.
& pwsh -NoProfile -File '.\build.ps1' -Task Build
if ($LASTEXITCODE -ne 0) {

Check warning on line 8 in tests/Functions/Private/New-KoanRunspace.Tests.ps1

View workflow job for this annotation

GitHub Actions / ci / Run Linters

Unknown word (LASTEXITCODE)
throw 'Failed to build PSKoans before running tests.'
}
Set-BuildEnvironment -Force
}
$manifest = Import-PowerShellDataFile -Path $env:BHPSModuleManifest

Check warning on line 13 in tests/Functions/Private/New-KoanRunspace.Tests.ps1

View workflow job for this annotation

GitHub Actions / ci / Run Linters

Unknown word (BHPS) Suggestions: (baps, bops, bhp, BHP, bps)
$outputDir = Join-Path -Path $env:BHProjectPath -ChildPath 'Output'
$outputModDir = Join-Path -Path $outputDir -ChildPath $env:BHProjectName
$outputModVerDir = Join-Path -Path $outputModDir -ChildPath $manifest.ModuleVersion
Expand Down Expand Up @@ -44,7 +44,8 @@

It 'preloads the runspace with PSKoans' {
$runspace = InModuleScope 'PSKoans' { New-KoanRunspace }
$ps = [powershell]::Create($runspace)
$ps = [powershell]::Create()
$ps.Runspace = $runspace

try {
$ps.AddCommand('Get-Module').AddParameter('Name', 'PSKoans') > $null
Expand Down
Loading