@@ -317,7 +317,6 @@ function Find-UnitySetupInstaller {
317
317
#>
318
318
function Install-UnitySetupInstance {
319
319
[CmdletBinding ()]
320
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute (' PSAvoidUsingWriteHost' , ' ' , Scope = ' Function' )]
321
320
param (
322
321
[parameter (ValueFromPipeline = $true )]
323
322
[UnitySetupInstaller []] $Installers ,
@@ -379,34 +378,31 @@ function Install-UnitySetupInstance {
379
378
Start-BitsTransfer - Source $downloadSource - Destination $downloadDest
380
379
}
381
380
382
- $spins = @ (' |' , ' /' , ' -' , ' \' )
383
381
for ($i = 0 ; $i -lt $localInstallers.Length ; $i ++ ) {
384
382
$installer = $localInstallers [$i ]
385
383
$destination = $localDestinations [$i ]
386
384
387
385
$startProcessArgs = @ {
388
386
' FilePath' = $installer ;
389
- ' ArgumentList' = @ (" /S" , " /D=$ ( $localDestinations [ $i ] ) " );
387
+ ' ArgumentList' = @ (" /S" , " /D=$destination " );
390
388
' PassThru' = $true ;
391
389
}
392
390
393
391
if ($Verb ) {
394
392
$startProcessArgs [' Verb' ] = $Verb
395
393
}
396
394
397
- $spinnerIndex = 0
395
+ Write-Verbose " $ ( Get-Date ) : Installing $installer to $destination . "
398
396
$process = Start-Process @startProcessArgs
399
- while (! $process.HasExited ) {
400
- Write-Host " `r Installing $installer to $destination - $ ( $spins [$spinnerIndex ++ % $spins.Length ]) " - NoNewline
401
- Start-Sleep - Milliseconds 100
402
- }
397
+ if ( $process ) {
398
+ $process.WaitForExit ()
403
399
404
- if ( $process.ExitCode -ne 0 ) {
405
- Write-Host " `b Failed. "
406
- Write-Error " Installing $installer failed with exit code: $ ( $process .ExitCode ) "
407
- }
408
- else {
409
- Write-Host " `b Succeeded. "
400
+ if ( $process.ExitCode -ne 0 ) {
401
+ Write-Error " $ ( Get-Date ) : Failed with exit code: $ ( $process .ExitCode ) "
402
+ }
403
+ else {
404
+ Write-Verbose " $ ( Get-Date ) : Succeeded. "
405
+ }
410
406
}
411
407
}
412
408
}
@@ -816,11 +812,11 @@ function Start-UnityEditor {
816
812
) | ForEach-Object {
817
813
818
814
$alias = Get-Alias - Name $_.Name - ErrorAction ' SilentlyContinue'
819
- if ( -not $alias ) {
815
+ if ( -not $alias ) {
820
816
Write-Verbose " Creating new alias $ ( $_.Name ) for $ ( $_.Value ) "
821
817
New-Alias @_
822
818
}
823
- elseif ( $alias.ModuleName -eq ' UnitySetup' ) {
819
+ elseif ( $alias.ModuleName -eq ' UnitySetup' ) {
824
820
Write-Verbose " Setting alias $ ( $_.Name ) to $ ( $_.Value ) "
825
821
Set-Alias @_
826
822
}
0 commit comments