Skip to content

Commit

Permalink
Allow multiple connection retries after user actions
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoTheThird committed Nov 6, 2019
1 parent 2274045 commit d416a31
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,14 @@ function installStep(step) {
"user:write:under",
"Adb is scanning for devices"
);
adb
.waitForDevice()
.then(resolve)
.catch(() => mainEvent.emit("user:connection-lost", resolve));
break;
function adbWait() {
return adb
.waitForDevice()
.catch(() =>
mainEvent.emit("user:connection-lost", adbWait)
);
}
return adbWait();
case "bootloader":
global.mainEvent.emit("user:write:working", "particles");
global.mainEvent.emit(
Expand All @@ -269,11 +272,14 @@ function installStep(step) {
"user:write:under",
"Fastboot is scanning for devices"
);
fastboot
.waitForDevice()
.then(resolve)
.catch(() => mainEvent.emit("user:connection-lost", resolve));
break;
function fastbootWait() {
return fastboot
.waitForDevice()
.catch(() =>
mainEvent.emit("user:connection-lost", fastbootWait)
);
}
return fastbootWait();
default:
resolve();
break;
Expand Down

0 comments on commit d416a31

Please sign in to comment.