From 0eadc66d93895e39d4afd695274dcad903352aa9 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Wed, 2 Feb 2022 15:46:41 +0100 Subject: [PATCH 1/2] fix(cli): Better error on gradlew permission problems --- cli/src/android/run.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/cli/src/android/run.ts b/cli/src/android/run.ts index 3b486fdebc..5d29c8b654 100644 --- a/cli/src/android/run.ts +++ b/cli/src/android/run.ts @@ -24,11 +24,20 @@ export async function runAndroid( debug('Invoking ./gradlew with args: %O', gradleArgs); - await runTask('Running Gradle build', async () => - runCommand('./gradlew', gradleArgs, { - cwd: config.android.platformDirAbs, - }), - ); + try { + await runTask('Running Gradle build', async () => + runCommand('./gradlew', gradleArgs, { + cwd: config.android.platformDirAbs, + }), + ); + } catch (e) { + if (e.includes('EACCES')) { + throw `gradlew file does not have executable permissions. This can happen if the Android platform was added on a Windows machine. Please run chmod +x ./${config.android.platformDir}/gradlew and try again.`; + } else { + throw e; + } + } + const apkPath = resolve( config.android.buildOutputDirAbs, config.android.apkName, From 113d28620458fa279422d5404b50d7504cfe88e9 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Wed, 2 Feb 2022 16:37:21 +0100 Subject: [PATCH 2/2] put chmod message in bold --- cli/src/android/run.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cli/src/android/run.ts b/cli/src/android/run.ts index 5d29c8b654..e8910331f1 100644 --- a/cli/src/android/run.ts +++ b/cli/src/android/run.ts @@ -32,7 +32,9 @@ export async function runAndroid( ); } catch (e) { if (e.includes('EACCES')) { - throw `gradlew file does not have executable permissions. This can happen if the Android platform was added on a Windows machine. Please run chmod +x ./${config.android.platformDir}/gradlew and try again.`; + throw `gradlew file does not have executable permissions. This can happen if the Android platform was added on a Windows machine. Please run ${c.strong( + `chmod +x ./${config.android.platformDir}/gradlew`, + )} and try again.`; } else { throw e; }