diff --git a/lib/emulator-manager.js b/lib/emulator-manager.js index 9c20d661..92207d33 100644 --- a/lib/emulator-manager.js +++ b/lib/emulator-manager.js @@ -31,7 +31,7 @@ function launchEmulator(apiLevel, target, arch, profile, headless, disableAnimat } else { console.log(`Creating AVD without custom profile.`); - yield exec.exec(`echo "no" | ${AVD_MANAGER_PATH} create avd --force -n test --abi "${target}/${arch}" --package "system-images;android-${apiLevel};${target};${arch}"`); + yield exec.exec(`bash -c \\"echo no | ${AVD_MANAGER_PATH} create avd --force -n test --abi '${target}/${arch}' --package 'system-images;android-${apiLevel};${target};${arch}'`); } // start emulator console.log('Starting emulator.'); diff --git a/lib/main.js b/lib/main.js index a80906de..5d0eff01 100644 --- a/lib/main.js +++ b/lib/main.js @@ -54,13 +54,16 @@ function run() { const disableAnimations = disableAnimationsInput === 'true'; console.log(`disable animations: ${disableAnimations}`); // custom scrpt to run - const script = core.getInput('script', { required: true }); + const scriptInput = core.getInput('script', { required: true }); + const commands = scriptInput.split(/\r?\n/); // install SDK yield sdk_installer_1.installAndroidSdk(apiLevel, target, arch); // launch an emulator yield emulator_manager_1.launchEmulator(apiLevel, target, arch, profile, headless, disableAnimations); // execute the custom script - yield exec.exec(`${script}`); + commands.forEach((command) => __awaiter(this, void 0, void 0, function* () { + yield exec.exec(`${command}`); + })); // finally kill the emulator yield emulator_manager_1.killEmulator(); }