From e1237cd0505d4587345e674e7a65c2b97192ccb5 Mon Sep 17 00:00:00 2001 From: viarotel Date: Mon, 30 Oct 2023 17:26:13 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E2=99=BB=EF=B8=8F=20Optimize=20Gnireht?= =?UTF-8?q?et=20interaction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/exposes/gnirehtet/index.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/electron/exposes/gnirehtet/index.js b/electron/exposes/gnirehtet/index.js index e6d59ca..5bea1bc 100644 --- a/electron/exposes/gnirehtet/index.js +++ b/electron/exposes/gnirehtet/index.js @@ -14,6 +14,12 @@ const shell = async (command, { debug = false, stdout, stderr } = {}) => { const spawnPath = appStore.get('common.gnirehtetPath') || gnirehtetPath const ADB = appStore.get('common.adbPath') || adbPath + if (!spawnPath) { + throw new Error( + 'Failed to retrieve Gnirehtet dependency path. If you\'re using macOS, please ensure that the dependency is installed correctly.', + ) + } + const GNIREHTET_APK = gnirehtetApkPath const args = command.split(' ') @@ -102,17 +108,16 @@ const installed = async (deviceId) => { const run = async (deviceId) => { await relay().catch((e) => { - throw new Error('Gnirehtet Relay fail') + throw new Error(e?.message || 'Gnirehtet Relay fail') }) - console.log('run.relay.success') + await install(deviceId).catch((e) => { - throw new Error('Gnirehtet Install Client fail') + throw new Error(e?.message || 'Gnirehtet Install Client fail') }) - console.log('run.install.success') + await start(deviceId).catch((e) => { - throw new Error('Gnirehtet Start fail') + throw new Error(e?.message || 'Gnirehtet Start fail') }) - console.log('run.start.success') } window.addEventListener('beforeunload', () => {