diff --git a/src/components/Device/components/TerminalAction/components/TerminalDialog/composables/adb-spawn.js b/src/components/Device/components/TerminalAction/components/TerminalDialog/composables/adb-async.js similarity index 100% rename from src/components/Device/components/TerminalAction/components/TerminalDialog/composables/adb-spawn.js rename to src/components/Device/components/TerminalAction/components/TerminalDialog/composables/adb-async.js diff --git a/src/components/Device/components/TerminalAction/components/TerminalDialog/composables/adb.js b/src/components/Device/components/TerminalAction/components/TerminalDialog/composables/adb.js index 1c98529..e381078 100644 --- a/src/components/Device/components/TerminalAction/components/TerminalDialog/composables/adb.js +++ b/src/components/Device/components/TerminalAction/components/TerminalDialog/composables/adb.js @@ -7,7 +7,18 @@ export function useAdb({ loading }) { loading.value = true const command = args.slice(1).join(' ') - const { stderr, stdout } = await $adb.shell(command || 'help') + let stderr + let stdout + + try { + const res = await $adb.shell(command || 'help') + + stdout = res?.stdout + stderr = res?.stderr + } + catch (error) { + stderr = error?.message || JSON.stringify(error) || 'Command failed' + } if (stderr) { return createStderr(stderr) diff --git a/src/components/Device/components/TerminalAction/components/TerminalDialog/index.vue b/src/components/Device/components/TerminalAction/components/TerminalDialog/index.vue index 9a4cd60..0ace9ac 100644 --- a/src/components/Device/components/TerminalAction/components/TerminalDialog/index.vue +++ b/src/components/Device/components/TerminalAction/components/TerminalDialog/index.vue @@ -45,7 +45,7 @@ import VueCommand, { listFormatter, } from 'vue-command' import 'vue-command/dist/vue-command.css' -import { useAdb } from './composables/adb.js' +import { useAdb } from './composables/adb-async.js' import { useScrcpy } from './composables/scrcpy.js' import { useGnirehtet } from './composables/gnirehtet.js'