@@ -315,7 +315,6 @@ function Find-UnitySetupInstaller {
315
315
#>
316
316
function Install-UnitySetupInstance {
317
317
[CmdletBinding ()]
318
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute (' PSAvoidUsingWriteHost' , ' ' , Scope = ' Function' )]
319
318
param (
320
319
[parameter (ValueFromPipeline = $true )]
321
320
[UnitySetupInstaller []] $Installers ,
@@ -377,34 +376,31 @@ function Install-UnitySetupInstance {
377
376
Start-BitsTransfer - Source $downloadSource - Destination $downloadDest
378
377
}
379
378
380
- $spins = @ (' |' , ' /' , ' -' , ' \' )
381
379
for ($i = 0 ; $i -lt $localInstallers.Length ; $i ++ ) {
382
380
$installer = $localInstallers [$i ]
383
381
$destination = $localDestinations [$i ]
384
382
385
383
$startProcessArgs = @ {
386
384
' FilePath' = $installer ;
387
- ' ArgumentList' = @ (" /S" , " /D=$ ( $localDestinations [ $i ] ) " );
385
+ ' ArgumentList' = @ (" /S" , " /D=$destination " );
388
386
' PassThru' = $true ;
389
387
}
390
388
391
389
if ($Verb ) {
392
390
$startProcessArgs [' Verb' ] = $Verb
393
391
}
394
392
395
- $spinnerIndex = 0
393
+ Write-Verbose " $ ( Get-Date ) : Installing $installer to $destination . "
396
394
$process = Start-Process @startProcessArgs
397
- while (! $process.HasExited ) {
398
- Write-Host " `r Installing $installer to $destination - $ ( $spins [$spinnerIndex ++ % $spins.Length ]) " - NoNewline
399
- Start-Sleep - Milliseconds 100
400
- }
395
+ if ( $process ) {
396
+ $process.WaitForExit ()
401
397
402
- if ( $process.ExitCode -ne 0 ) {
403
- Write-Host " `b Failed. "
404
- Write-Error " Installing $installer failed with exit code: $ ( $process .ExitCode ) "
405
- }
406
- else {
407
- Write-Host " `b Succeeded. "
398
+ if ( $process.ExitCode -ne 0 ) {
399
+ Write-Error " $ ( Get-Date ) : Failed with exit code: $ ( $process .ExitCode ) "
400
+ }
401
+ else {
402
+ Write-Verbose " $ ( Get-Date ) : Succeeded. "
403
+ }
408
404
}
409
405
}
410
406
}
0 commit comments