Comments (7)
I agree that the documentation is wrong, we'll need to fix that. But I don't see how you would get either a buffer or a stream randomly... I just tried the example code as-is and it worked fine. Can you share some more details about your investigation?
from adbkit.
Sure, I'm glad to help.
I call this code as a part of my device resilience subsystem:
client.shell(serial, 'ifconfig wlan0')
.then(adb.util.readAll)
.then(function commandResult(result) {
return result.toString()
});
...and, as you've already suggested, it produces the error in a random way :(
I have no idea, maybe it's the command, maybe it's the device the thing is I randomly get a Buffer
instead of a Stream
.
I totally forgot to add my env data:
Version of adbkit: 2.3.1
Node: 0.10.40
System: Windows Server 2012 R2
Device: Nexus 7, Android 5.1.1
Other than that, GREAT JOB, this module saves lives ;)
from adbkit.
Might be worth trying with Node 0.12 or 4.x. We haven't tested 0.10 in a long time and there were some stream-related changes in 0.12 that I remember having to fix (although it could have been just that our code was bad). Also we've never tested anything on Windows... :)
Are you sure it really returns a buffer and not something else? Could you do .then(function(really) { console.log('really?', really, typeof really) })
instead of readAll?
from adbkit.
Also, https://github.com/petkaantonov/bluebird/blob/master/API.md#promiselongstacktraces---void may or may not help a little in providing a more useful stack trace.
from adbkit.
I will update my node.js
to 0.12.7, and I will check the Buffer
hipothesis :)
Thanks!
from adbkit.
So after one day of scrutinizing the code, and running test on real hardware there and back again, it seems that there was an issue with the old version of node.js.
The 0.12.7
version appears to be as stable as a solid rock.
Thanks for all the help :)
from adbkit.
It took me awhile to figure out how to use readAll()
with Promises so I'm positing it here to help others:
const stream = await adbClient.shell( config.udid, "ime list -s" )
const result = await adb.util.readAll( stream );
console.log( result.toString() ); // => com.sec.android.inputmethod/.SamsungKeypad
from adbkit.
Related Issues (20)
- Can't use "bugreport xx.zip" with a mobile phone with adbkit HOT 4
- Add option to install APKs with all runtime permission granted automatically HOT 2
- Minicap and Minitouch in my personal project HOT 1
- Pushed file mode is not set successfully HOT 1
- sync.pull() HOT 1
- Please release a new version with #127 to npm HOT 3
- Error Unhandled rejection FailError: Failure: 'device still authorizing' HOT 2
- This project is no longer maintained HOT 1
- client .trackDevices() is not working HOT 2
- adb connect api issue
- sync mkdir
- install process
- Request node-forge version up
- use adbkit run shell auto stop
- @devicefarmer/adbkit@2
- "\"/system/bin/sh: echo 111: inaccessible or not found\\n\""
- I will run client.framebuffer is not working. HOT 1
- Calling cancel doesn't work on PullTransfer HOT 1
- Can this tool support the openharmony hdc
- wait for device without serial no
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adbkit.