adbkit icon indicating copy to clipboard operation
adbkit copied to clipboard

client.disconnect(host,port) exception

Open mgleria opened this issue 8 years ago • 2 comments

Hi. When I execute the function:

client.disconnect(host,port)
.then(function(id){
    console.log('Device id:',id,'disconected');})
.catch(function(err){	
    console.error('Something went wrong:', err.stack)})

I get the next output:

Something went wrong: Error: disconnected 172.30.1.67:5555 at /home/martin/Docker/node_modules/adbkit/lib/adb/command/host/disconnect.js:30:23 at tryCatcher (/home/martin/Docker/node_modules/bluebird/js/main/util.js:26:23) at Promise._settlePromiseFromHandler (/home/martin/Docker/node_modules/bluebird/js/main/promise.js:503:31) at Promise._settlePromiseAt (/home/martin/Docker/node_modules/bluebird/js/main/promise.js:577:18) at Async._drainQueue (/home/martin/Docker/node_modules/bluebird/js/main/async.js:128:12) at Async._drainQueues (/home/martin/Docker/node_modules/bluebird/js/main/async.js:133:10) at Immediate.Async.drainQueues (/home/martin/Docker/node_modules/bluebird/js/main/async.js:15:14) at runCallback (timers.js:800:20) at tryOnImmediate (timers.js:762:5) at processImmediate [as _immediateCallback] (timers.js:733:5)

However, the function seems to work because the device is no longer visible after the function is run. What surprises me is that the function client.connect is working great, and is very similar:

client.connect(host,port)
.then(function(id){
    console.log('Device id:',id,'conected');})
.catch(function(err){
    console.error('Something went wrong:', err.stack)})

Any ideas or suggestion?

mgleria avatar Jul 17 '17 14:07 mgleria

I had the same result. The error is comes from here:

              if (RE_OK.test(value)) {
                return host + ":" + port;
              } else {
                throw new Error(value.toString());
              }
            });

Actually the value is "disconnected host:port" the RE_OK regexp is waiting for an empty string. That is why the error appears.

You were right, the disconnect() call was successful but the handling of it wasn't.

@sorccu

iabukai avatar Nov 16 '17 15:11 iabukai

Thank you for your feedback.

mgleria avatar Nov 22 '17 12:11 mgleria