Skip to content

Commit

Permalink
Merge pull request #63 from ubports/connection-reset
Browse files Browse the repository at this point in the history
Handle connection reset
  • Loading branch information
NeoTheThird authored Mar 24, 2022
2 parents be88acd + 145a0e2 commit 1cad8e3
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 41 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ promise-android-tools versioning started at 1.0.0, but this changelog was not ad
### New

- Adb: add getprop() and getSystemImageCapability() ([#61](https://github.com/ubports/promise-android-tools/pull/61))

### Changed

- Update dependencies ([6d47250c40bdf9dc1a24d748e72b13f8d50ae36d](https://github.com/ubports/promise-android-tools/commit/6d47250c40bdf9dc1a24d748e72b13f8d50ae36d))

## [4.0.8] - 2022-03-10
Expand Down
60 changes: 21 additions & 39 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "promise-android-tools",
"version": "4.0.9",
"version": "4.0.10",
"description": "A wrapper for adb, fastboot, and heimdall that returns convenient promises.",
"main": "./lib/module.cjs",
"type": "module",
Expand Down
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 1cad8e3

Please sign in to comment.