Skip to content

Commit

Permalink
Handle protocol fault / connection reset error seen in ubports/ubport…
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoTheThird committed Mar 23, 2022
1 parent be88acd commit fcd920d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/adb.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ export class Adb extends Tool {
stderr?.includes("error: device still authorizing")
) {
return "unauthorized";
} else if (stderr?.includes("error: device offline")) {
} else if (
stderr?.includes("error: device offline") ||
stderr?.includes("error: protocol fault") ||
stderr?.includes("connection reset")
) {
return "device offline";
} else if (
stderr?.includes("no devices/emulators found") ||
Expand Down
9 changes: 9 additions & 0 deletions tests/test-data/known_errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ export const adbErrors = [
error: { killed: false, code: 1, signal: null, cmd: "command" },
stdout: "",
stderr: "error: error: device offline\n"
},
{
expectedReturn: "device offline",
error: {
message:
"Command failed: adb.exe -P 5037 shell getprop ro.product.device\nerror: protocol fault (couldn't read status): connection reset",
code: 1
},
stderr: "error: protocol fault (couldn't read status): connection reset"
}
];

Expand Down

0 comments on commit fcd920d

Please sign in to comment.