diff --git a/Private/Invoke-ExecuteCommand.ps1 b/Private/Invoke-ExecuteCommand.ps1 index d861814..f9fbdba 100644 --- a/Private/Invoke-ExecuteCommand.ps1 +++ b/Private/Invoke-ExecuteCommand.ps1 @@ -10,13 +10,15 @@ function Invoke-ExecuteCommand ($finalCommand, $executor, $executionPlatform, $T $execPrefix = "/c"; $execExe = "cmd.exe"; $execCommand = $finalCommand -replace "`n", " & " - } + $arguments = $execPrefix,"$execCommand" + } else { $finalCommand = $finalCommand -replace "[\\](?!;)", "`\$&" $finalCommand = $finalCommand -replace "[`"]", "`\$&" $execCommand = $finalCommand -replace "(? $null $process.BeginOutputReadLine() $process.BeginErrorReadLine() - $StdIn = $process.StandardInput - $StdIn.Close() # wait for complete $Timeout = [System.TimeSpan]::FromSeconds(($TimeoutSeconds)) $isTimeout = $false @@ -138,7 +136,7 @@ function Invoke-Process { [string]$FileName, [parameter(Mandatory = $false)] - [string]$Arguments, + [string[]]$Arguments, [parameter(Mandatory = $false)] [string]$WorkingDirectory @@ -150,7 +148,6 @@ function Invoke-Process { $psi.UseShellExecute = $false $psi.RedirectStandardOutput = $true $psi.RedirectStandardError = $true - $psi.RedirectStandardInput = $true $psi.FileName = $FileName $psi.Arguments+= $Arguments $psi.WorkingDirectory = $WorkingDirectory diff --git a/Public/Invoke-AtomicRunner.ps1 b/Public/Invoke-AtomicRunner.ps1 index e4df1eb..b918520 100755 --- a/Public/Invoke-AtomicRunner.ps1 +++ b/Public/Invoke-AtomicRunner.ps1 @@ -33,6 +33,10 @@ function Invoke-AtomicRunner { [Parameter(Mandatory = $false)] $ListOfAtomics, + [parameter(Mandatory = $false)] + [ValidateRange(0, [int]::MaxValue)] + [int] $PauseBetweenAtomics, + [Parameter(Mandatory = $false, ValueFromRemainingArguments = $true)] $OtherArgs ) @@ -70,6 +74,14 @@ function Invoke-AtomicRunner { } if ($Cleanup) { if (Get-Command 'Invoke-AtomicRunnerPostAtomicCleanupHook' -errorAction SilentlyContinue) { Invoke-AtomicRunnerPostAtomicCleanupHook } } elseif (-not($ShowDetails -or $CheckPrereqs -or $ShowDetailsBrief -or $GetPrereqs)) { if (Get-Command 'Invoke-AtomicRunnerPostAtomicHook' -errorAction SilentlyContinue) { Invoke-AtomicRunnerPostAtomicHook } } + if ($timeToPause -gt 0) { + Write-Host "Sleeping for $timeToPause seconds..." + Start-Sleep $timeToPause + } + elseif ($timeToPause -eq 0) { + Write-Host 'Press any key to continue...'; + $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown'); + } } function Rename-ThisComputer ($tr, $basehostname) { @@ -158,11 +170,17 @@ function Invoke-AtomicRunner { } } } - + if ($PSBoundParameters.ContainsKey("PauseBetweenAtomics")) { + $timeToPause = $PauseBetweenAtomics + } + else { + $timeToPause = $null + } $htvars += [Hashtable]$PSBoundParameters $htvars.Remove('listOfAtomics') | Out-Null $htvars.Remove('OtherArgs') | Out-Null $htvars.Remove('Cleanup') | Out-Null + $htvars.Remove('PauseBetweenAtomics') | Out-Null $schedule = Get-Schedule $listOfAtomics # If the schedule is empty, end process @@ -232,4 +250,4 @@ function Invoke-AtomicRunner { Rename-ThisComputer $tr $artConfig.basehostname } -} +} \ No newline at end of file diff --git a/Public/Invoke-AtomicTest.ps1 b/Public/Invoke-AtomicTest.ps1 index 5971b02..2467f13 100644 --- a/Public/Invoke-AtomicTest.ps1 +++ b/Public/Invoke-AtomicTest.ps1 @@ -207,7 +207,7 @@ function Invoke-AtomicTest { $ShortTestNumbers = $AtomicTechniqueParams[-1] } - if ($TestNumbers -eq $null -and $ShortTestNumbers -ne $null) { + if ($null -eq $TestNumbers -and $null -ne $ShortTestNumbers) { $TestNumbers = $ShortTestNumbers -split ',' } @@ -222,15 +222,15 @@ function Invoke-AtomicTest { $commandLine = "$commandLine -ShowDetailsBrief $ShowDetailsBrief" } - if ($TestNumbers -ne $null) { + if ($null -ne $TestNumbers) { $commandLine = "$commandLine -TestNumbers $TestNumbers" } - if ($TestNames -ne $null) { + if ($null -ne $TestNames) { $commandLine = "$commandLine -TestNames $TestNames" } - if ($TestGuids -ne $null) { + if ($null -ne $TestGuids) { $commandLine = "$commandLine -TestGuids $TestGuids" } @@ -285,7 +285,7 @@ function Invoke-AtomicTest { $commandLine = "$commandLine -KeepStdOutStdErrFiles $KeepStdOutStdErrFiles" } - if ($LoggingModule -ne $null) { + if ($null -ne $LoggingModule) { $commandLine = "$commandLine -LoggingModule $LoggingModule" } @@ -368,7 +368,7 @@ function Invoke-AtomicTest { $testCount++ - if (($ShowDetails -or $ShowDetailsBrief) -and -not $anyOS) { + if (-not $anyOS) { if ( -not $(Platform-IncludesCloud) -and -Not $test.supported_platforms.Contains($executionPlatform) ) { Write-Verbose -Message "Unable to run non-$executionPlatform tests" continue