Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,10 @@ public void Start(Runspace runspace)
Runspace.DefaultRunspace = runspace;
runspace.ExecutionContext.SessionState.Internal.SetLocation(_currentLocationPath);
}
catch (DriveNotFoundException)
{
// Allow task to run if current drive is not available.
Comment thread
SteveL-MSFT marked this conversation as resolved.
}
finally
{
Runspace.DefaultRunspace = oldDefaultRunspace;
Comment thread
iSazonov marked this conversation as resolved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,20 @@ Describe 'ForEach-Object -Parallel Basic Tests' -Tags 'CI' {
$parallelScriptLocation = 1..1 | ForEach-Object -Parallel { $PWD }
$parallelScriptLocation.Path | Should -BeExactly $PWD.Path
}

It 'Verifies no terminating error if current working drive is not found' {
$oldLocation = Get-Location
try
{
New-PSDrive -Name ZZ -PSProvider FileSystem -Root $TestDrive
Set-Location -Path 'ZZ:'
{ 1..1 | ForEach-Object -Parallel { $_ } } | Should -Not -Throw
}
finally
{
Set-Location -Path $oldLocation
}
}
}

Describe 'ForEach-Object -Parallel common parameters' -Tags 'CI' {
Expand Down