fix: 🐛 Abnormal built-in terminal adb command

This commit is contained in:
viarotel 2024-03-10 22:07:31 +08:00
parent bf2d2b47b4
commit 368551a954
3 changed files with 13 additions and 2 deletions

View File

@ -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)

View File

@ -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'