Skip to content
This repository was archived by the owner on Aug 11, 2024. It is now read-only.

Commit d958050

Browse files
.
1 parent cf50450 commit d958050

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

dist/unity-install.ps1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,15 +344,12 @@ function Run-As {
344344
$psi.Arguments = $arguments;
345345
$psi.CreateNoWindow = $true;
346346
$psi.RedirectStandardInput = $true;
347-
$psi.RedirectStandardOutput = $true;
348347
$p = [System.Diagnostics.Process]::Start($psi);
348+
$p.StandardInput.WriteLine("y");
349349
while (-not $p.HasExited) {
350-
$line = $p.StandardOutput.ReadLine()
351-
Write-Host $line
352350
if ($line -match 'y/N') {
353351
$p.StandardInput.WriteLine("y");
354352
}
355-
# sleep for a ms
356353
Start-Sleep -Milliseconds 1
357354
}
358355

@@ -385,7 +382,8 @@ if ($modules -contains 'android') {
385382
exit 1
386383
}
387384
Write-Host "Accepting Android SDK Licenses"
388-
Run-As -command "$androidSdkManagerPath" -arguments "--licenses"
385+
# run sdkmanager --licenses and redirect input to accept all licenses by sending 'y' to stdin
386+
389387
Write-Host "Updating Android SDK"
390388
Run-As -command "$androidSdkManagerPath" -arguments "--update"
391389
$projectSettingsPath = $env:UNITY_PROJECT_PATH + "/ProjectSettings/ProjectSettings.asset"

src/unity-install.ps1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,15 +344,12 @@ function Run-As {
344344
$psi.Arguments = $arguments;
345345
$psi.CreateNoWindow = $true;
346346
$psi.RedirectStandardInput = $true;
347-
$psi.RedirectStandardOutput = $true;
348347
$p = [System.Diagnostics.Process]::Start($psi);
348+
$p.StandardInput.WriteLine("y");
349349
while (-not $p.HasExited) {
350-
$line = $p.StandardOutput.ReadLine()
351-
Write-Host $line
352350
if ($line -match 'y/N') {
353351
$p.StandardInput.WriteLine("y");
354352
}
355-
# sleep for a ms
356353
Start-Sleep -Milliseconds 1
357354
}
358355

@@ -385,7 +382,8 @@ if ($modules -contains 'android') {
385382
exit 1
386383
}
387384
Write-Host "Accepting Android SDK Licenses"
388-
Run-As -command "$androidSdkManagerPath" -arguments "--licenses"
385+
# run sdkmanager --licenses and redirect input to accept all licenses by sending 'y' to stdin
386+
389387
Write-Host "Updating Android SDK"
390388
Run-As -command "$androidSdkManagerPath" -arguments "--update"
391389
$projectSettingsPath = $env:UNITY_PROJECT_PATH + "/ProjectSettings/ProjectSettings.asset"

0 commit comments

Comments
 (0)