Skip to content

Commit

Permalink
Do not stop already stopped jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
MVKozlov committed Dec 26, 2018
1 parent 6b6f271 commit 40020a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion PoshRSJob/Public/Stop-RSJob.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Function Stop-RSJob {
if ($Job) {
$Job | ForEach-Object {
Write-Verbose "Stopping $($_.InstanceId)"
if ($_.State -ne 'Completed') {
if ($_.State -ne 'Completed' -and $_.State -ne 'Failed' -and $_.State -ne 'Stopped') {
Write-Verbose "Killing job $($_.InstanceId)"
[void] $_.InnerJob.Stop()
}
Expand Down

0 comments on commit 40020a5

Please sign in to comment.