Skip to content

Commit 9c74c48

Browse files
unity-setup@v2.0.5 (#53)
- updated unity-cli@v1.3.3
1 parent 7b333ee commit 9c74c48

File tree

4 files changed

+35
-12
lines changed

4 files changed

+35
-12
lines changed

dist/index.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3308,10 +3308,18 @@ async function execSdkManager(sdkManagerPath, javaPath, args) {
33083308
}
33093309
try {
33103310
exitCode = await new Promise((resolve, reject) => {
3311-
const child = (0, child_process_1.spawn)(sdkManagerPath, args, {
3311+
let cmd = sdkManagerPath;
3312+
let cmdArgs = args;
3313+
if (process.platform === 'win32') {
3314+
if (!(0, utilities_1.isProcessElevated)()) {
3315+
throw new Error('Android SDK installation requires elevated (administrator) privileges. Please rerun as Administrator.');
3316+
}
3317+
cmd = 'cmd.exe';
3318+
cmdArgs = ['/c', sdkManagerPath, ...args];
3319+
}
3320+
const child = (0, child_process_1.spawn)(cmd, cmdArgs, {
33123321
stdio: ['pipe', 'pipe', 'pipe'],
33133322
env: {
3314-
...process.env,
33153323
JAVA_HOME: process.platform === 'win32' ? `"${javaPath}"` : javaPath
33163324
}
33173325
});
@@ -3331,7 +3339,7 @@ async function execSdkManager(sdkManagerPath, javaPath, args) {
33313339
function handleDataStream(data) {
33323340
const chunk = data.toString();
33333341
output += chunk;
3334-
process.stderr.write(chunk);
3342+
process.stdout.write(chunk);
33353343
}
33363344
const acceptBuffer = Buffer.from(Array(10).fill('y').join(os_1.default.EOL), 'utf8');
33373345
child.stdin.write(acceptBuffer);
@@ -5942,6 +5950,7 @@ exports.WaitForFileToBeUnlocked = WaitForFileToBeUnlocked;
59425950
exports.TestFileAccess = TestFileAccess;
59435951
exports.KillProcess = KillProcess;
59445952
exports.KillChildProcesses = KillChildProcesses;
5953+
exports.isProcessElevated = isProcessElevated;
59455954
const os = __importStar(__nccwpck_require__(2037));
59465955
const fs = __importStar(__nccwpck_require__(7147));
59475956
const path = __importStar(__nccwpck_require__(1017));
@@ -6456,6 +6465,20 @@ async function KillChildProcesses(procInfo) {
64566465
logger.error(`Failed to kill child processes of pid ${procInfo.pid}:\n${JSON.stringify(error)}`);
64576466
}
64586467
}
6468+
/**
6469+
* Checks if the current process is running with elevated (administrator) privileges.
6470+
* @returns True if the process is elevated, false otherwise.
6471+
*/
6472+
function isProcessElevated() {
6473+
if (process.platform !== 'win32') {
6474+
return true;
6475+
} // We can sudo easily on non-windows platforms
6476+
const probe = (0, child_process_1.spawnSync)('powershell.exe', [
6477+
'-NoLogo', '-NoProfile', '-Command',
6478+
"[Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent().IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)"
6479+
], { encoding: 'utf8' });
6480+
return probe.status === 0 && probe.stdout.trim().toLowerCase() === 'true';
6481+
}
64596482
//# sourceMappingURL=utilities.js.map
64606483

64616484
/***/ }),

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "unity-setup",
3-
"version": "2.0.4",
3+
"version": "2.0.5",
44
"description": "A GitHub action for setting up the Unity Game Engine for CI/CD workflows.",
55
"author": "RageAgainstThePixel",
66
"license": "MIT",
@@ -27,7 +27,7 @@
2727
"@actions/core": "^1.11.1",
2828
"@actions/exec": "^1.1.1",
2929
"@actions/glob": "^0.5.0",
30-
"@rage-against-the-pixel/unity-cli": "^1.3.2",
30+
"@rage-against-the-pixel/unity-cli": "^1.3.3",
3131
"semver": "^7.7.3",
3232
"yaml": "^2.8.1"
3333
},

0 commit comments

Comments
 (0)