Skip to content

Commit

Permalink
Properly handle very short connection drops, fix #846
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoTheThird committed Jul 27, 2019
1 parent 13c9376 commit 25b3fc6
Showing 1 changed file with 5 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 @@ -166,7 +166,11 @@ var push = (file, dest, pushEvent) => {
if (err) {
var stdoutShort = stdout && stdout.length > 256 ? "[...]" + stdout.substr(-256, stdout.length) : stdout;
var stderrShort = stderr && stderr.length > 256 ? "[...]" + stderr.substr(-256, stderr.length) : stderr;
if (!err.killed && (err.code == 1)) {
if (stderrShort.indexOf("I/O error") != -1) {
utils.log.warn("connection to device lost");
// TODO: Only restart the event rather than the entire installation
pushEvent.emit("user:connection-lost", () => { location.reload(); });
} else if (!err.killed && (err.code == 1)) {
hasAdbAccess ((hasAccess) => {
if (hasAccess) {
pushEvent.emit("adbpush:error", err + ", stdout: " + stdoutShort + ", stderr: " + stderrShort);
Expand Down

0 comments on commit 25b3fc6

Please sign in to comment.