mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix another Start-Process test
This test was not viable as it didn't retain the process object, instead relying on Get-Process with the process name, which could fail to get the correct process (since no PID was available). Since it is pointless to test Start-Process without -PassThru, and that test was the exact same code as the fixed first test, it was removed.
This commit is contained in:
@@ -19,18 +19,6 @@ Describe "Start-Process" {
|
||||
}
|
||||
|
||||
It "Should process arguments without error" {
|
||||
{ Start-Process ping -ArgumentList $pingParamNoStop} | Should Not Throw
|
||||
|
||||
$process = Get-Process -Name ping
|
||||
|
||||
$process.Length | Should Be 1
|
||||
$process.Id | Should BeGreaterThan 1
|
||||
$process.ProcessName | Should Be "ping"
|
||||
|
||||
Stop-Process -Id $process.Id
|
||||
}
|
||||
|
||||
It "Should create process object when used with PassThru argument" {
|
||||
$process = Start-Process ping -ArgumentList $pingParamNoStop -PassThru
|
||||
|
||||
$process.Length | Should Be 1
|
||||
@@ -52,6 +40,7 @@ Describe "Start-Process" {
|
||||
|
||||
It "Should invoke correct path when used with FilePath argument" {
|
||||
$process = Start-Process -FilePath $pingCommand -ArgumentList $pingParamNoStop -PassThru
|
||||
|
||||
$process.Length | Should Be 1
|
||||
$process.Id | Should BeGreaterThan 1
|
||||
$process.ProcessName | Should Be "ping"
|
||||
@@ -87,7 +76,6 @@ Describe "Start-Process" {
|
||||
It "Should should handle stdout redirection without error" {
|
||||
$process = Start-Process ping -ArgumentList $pingParamStop -Wait -RedirectStandardOutput $tempFile
|
||||
$dirEntry = dir $tempFile
|
||||
|
||||
$dirEntry.Length | Should BeGreaterThan 0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user