Skip to content

Commit 3f26666

Browse files
committed
Merges in latest from the remote to resolve merge issues.
2 parents 28beadf + ba790c9 commit 3f26666

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

UnitySetup/UnitySetup.psm1

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@ function Find-UnitySetupInstaller {
344344
#>
345345
function Install-UnitySetupInstance {
346346
[CmdletBinding()]
347-
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Scope = 'Function')]
348347
param(
349348
[parameter(ValueFromPipeline = $true)]
350349
[UnitySetupInstaller[]] $Installers,
@@ -405,35 +404,32 @@ function Install-UnitySetupInstance {
405404

406405
Start-BitsTransfer -Source $downloadSource -Destination $downloadDest
407406
}
408-
409-
$spins = @('|', '/', '-', '\')
407+
410408
for ($i = 0; $i -lt $localInstallers.Length; $i++) {
411409
$installer = $localInstallers[$i]
412410
$destination = $localDestinations[$i]
413411

414412
$startProcessArgs = @{
415413
'FilePath' = $installer;
416-
'ArgumentList' = @("/S", "/D=$($localDestinations[$i])");
414+
'ArgumentList' = @("/S", "/D=$destination");
417415
'PassThru' = $true;
418416
}
419417

420418
if ($Verb) {
421419
$startProcessArgs['Verb'] = $Verb
422420
}
423-
424-
$spinnerIndex = 0
421+
422+
Write-Verbose "$(Get-Date): Installing $installer to $destination."
425423
$process = Start-Process @startProcessArgs
426-
while (!$process.HasExited) {
427-
Write-Host "`rInstalling $installer to $destination - $($spins[$spinnerIndex++ % $spins.Length])" -NoNewline
428-
Start-Sleep -Milliseconds 100
429-
}
424+
if( $process ) {
425+
$process.WaitForExit()
430426

431-
if ( $process.ExitCode -ne 0) {
432-
Write-Host "`bFailed."
433-
Write-Error "Installing $installer failed with exit code: $($process.ExitCode)"
434-
}
435-
else {
436-
Write-Host "`bSucceeded."
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+
}
437433
}
438434
}
439435
}
@@ -832,12 +828,18 @@ function Start-UnityEditor {
832828
# clone the shared args list
833829
$unityArgs = $sharedArgs | ForEach-Object { $_ }
834830
if ( $instanceArgs[$i] ) { $unityArgs += $instanceArgs[$i] }
831+
835832
$setProcessArgs = @{
836833
'FilePath' = $editor;
837834
'PassThru' = $true;
838835
'ErrorAction' = 'Stop';
836+
'RedirectStandardOutput' = New-TemporaryFile;
837+
'RedirectStandardError' = New-TemporaryFile;
839838
}
840839

840+
Write-Verbose "Redirecting standard output to $($setProcessArgs['RedirectStandardOutput'])"
841+
Write-Verbose "Redirecting standard error to $($setProcessArgs['RedirectStandardError'])"
842+
841843
if ($unityArgs -and $unityArgs.Length -gt 0) {
842844
$setProcessArgs['ArgumentList'] = $unityArgs
843845
}

0 commit comments

Comments
 (0)