@@ -344,7 +344,6 @@ function Find-UnitySetupInstaller {
344
344
#>
345
345
function Install-UnitySetupInstance {
346
346
[CmdletBinding ()]
347
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute (' PSAvoidUsingWriteHost' , ' ' , Scope = ' Function' )]
348
347
param (
349
348
[parameter (ValueFromPipeline = $true )]
350
349
[UnitySetupInstaller []] $Installers ,
@@ -405,35 +404,32 @@ function Install-UnitySetupInstance {
405
404
406
405
Start-BitsTransfer - Source $downloadSource - Destination $downloadDest
407
406
}
408
-
409
- $spins = @ (' |' , ' /' , ' -' , ' \' )
407
+
410
408
for ($i = 0 ; $i -lt $localInstallers.Length ; $i ++ ) {
411
409
$installer = $localInstallers [$i ]
412
410
$destination = $localDestinations [$i ]
413
411
414
412
$startProcessArgs = @ {
415
413
' FilePath' = $installer ;
416
- ' ArgumentList' = @ (" /S" , " /D=$ ( $localDestinations [ $i ] ) " );
414
+ ' ArgumentList' = @ (" /S" , " /D=$destination " );
417
415
' PassThru' = $true ;
418
416
}
419
417
420
418
if ($Verb ) {
421
419
$startProcessArgs [' Verb' ] = $Verb
422
420
}
423
-
424
- $spinnerIndex = 0
421
+
422
+ Write-Verbose " $ ( Get-Date ) : Installing $installer to $destination . "
425
423
$process = Start-Process @startProcessArgs
426
- while (! $process.HasExited ) {
427
- Write-Host " `r Installing $installer to $destination - $ ( $spins [$spinnerIndex ++ % $spins.Length ]) " - NoNewline
428
- Start-Sleep - Milliseconds 100
429
- }
424
+ if ( $process ) {
425
+ $process.WaitForExit ()
430
426
431
- if ( $process.ExitCode -ne 0 ) {
432
- Write-Host " `b Failed. "
433
- Write-Error " Installing $installer failed with exit code: $ ( $process .ExitCode ) "
434
- }
435
- else {
436
- Write-Host " `b Succeeded. "
427
+ if ( $process.ExitCode -ne 0 ) {
428
+ Write-Error " $ ( Get-Date ) : Failed with exit code: $ ( $process .ExitCode ) "
429
+ }
430
+ else {
431
+ Write-Verbose " $ ( Get-Date ) : Succeeded. "
432
+ }
437
433
}
438
434
}
439
435
}
@@ -832,12 +828,18 @@ function Start-UnityEditor {
832
828
# clone the shared args list
833
829
$unityArgs = $sharedArgs | ForEach-Object { $_ }
834
830
if ( $instanceArgs [$i ] ) { $unityArgs += $instanceArgs [$i ] }
831
+
835
832
$setProcessArgs = @ {
836
833
' FilePath' = $editor ;
837
834
' PassThru' = $true ;
838
835
' ErrorAction' = ' Stop' ;
836
+ ' RedirectStandardOutput' = New-TemporaryFile ;
837
+ ' RedirectStandardError' = New-TemporaryFile ;
839
838
}
840
839
840
+ Write-Verbose " Redirecting standard output to $ ( $setProcessArgs [' RedirectStandardOutput' ]) "
841
+ Write-Verbose " Redirecting standard error to $ ( $setProcessArgs [' RedirectStandardError' ]) "
842
+
841
843
if ($unityArgs -and $unityArgs.Length -gt 0 ) {
842
844
$setProcessArgs [' ArgumentList' ] = $unityArgs
843
845
}
0 commit comments