add try catch for shell command

This commit is contained in:
Lei PAN
2023-07-10 17:13:21 +02:00
parent af0a41a517
commit 5818ca302e
+11 -7
View File
@@ -1022,13 +1022,17 @@ class CommandorPage {
async enableDisableAirPlanMode() { async enableDisableAirPlanMode() {
logWithDevice("will enable airplane mode", this.device) logWithDevice("will enable airplane mode", this.device)
await this.device.shell("cmd connectivity airplane-mode enable") try {
// await this.device.shell("adb shell settings put global airplane_mode_on 1") await this.device.shell("cmd connectivity airplane-mode enable")
await delay(1000) // await this.device.shell("adb shell settings put global airplane_mode_on 1")
// await this.device.shell("adb shell settings put global airplane_mode_on 0") await delay(1000)
await this.device.shell("cmd connectivity airplane-mode disable") // await this.device.shell("adb shell settings put global airplane_mode_on 0")
await delay(2000) await this.device.shell("cmd connectivity airplane-mode disable")
await delay(2000)
} catch (e) {
await this.device.shell("cmd connectivity airplane-mode disable")
console.log(e)
}
} }
} }