Comments (10)
While waiting for
read()
(here), ifisClosed
is set true (here),read()
would throw Exception (here) even ifreadQueue
is still receiving stdout/stderr data (here) and we have one or more messages to beread()
and displayed yet.
I hope this makes sense 😄
Ah, yeah that makes sense thanks! I've been running into this bug as well, but I hadn't realised why it was happening until I saw your fix!
I've just raised #11 to get this fixed in com.tananaev.adblib
as well. I implemented the fix without changing the API to keep things simple for existing apps that use code like this:
while (!stream.isClosed()) {
stream.read();
// etc
}
from adblib.
Ideas sound good to me. Please make sure to make small PRs for each change, so it can be easily reviewed.
from adblib.
Sure!
Thanks.
Does that fix the issue where
read()
sometimes fails with anIOException
instead of sending back the response text?try (AdbStream stream = connection.open("shell:echo Hello world")) { byte[] response = stream.read(); String responseText = new String(response, StandardCharsets.UTF_8); Assert.assertEquals("Hello world", responseText.trim()); }
While waiting for read()
(here), if isClosed
is set true (here), read()
would throw Exception (here) even if readQueue
is still receiving stdout/stderr data (here) and we have one or more messages to be read()
and displayed yet.
I hope this makes sense 😄
So the following would definitely throw IOException on first read()
without printing anything:
try (AdbStream stream = connection.open("shell:echo Hello world")) {
SystemClock.sleep(1000);
byte[] response = stream.read();
System.out.println(new String(response, StandardCharsets.UTF_8).trim());
}
I've tried to fix this.
from adblib.
Will do!
Just regarding upgrading the protocol version, after further testing, it looks like the hanging connection issue wasn't related to protocol version after all, so I'll leave it at the original version.
from adblib.
Raised #7 for the thread safety issues
from adblib.
Raised #9 for timeout option
from adblib.
Raised #10 for auth exception
from adblib.
Closing this issue since it's been converted to pull requests
from adblib.
@tananaev @sampalmer may I merge recent PRs to com.cgutman.adblib
(https://github.com/mirfatif/AdbLib)?
from adblib.
@tananaev @sampalmer may I merge recent PRs to
com.cgutman.adblib
(https://github.com/mirfatif/AdbLib)?
Sure!
I just looked at your fork and noticed you have a fix for AdbStream.read()
: mirfatif/AdbLib@aaa08a4.
Does that fix the issue where read()
sometimes fails with an IOException
instead of sending back the response text?
try (AdbStream stream = connection.open("shell:echo Hello world")) {
byte[] response = stream.read();
String responseText = new String(response, StandardCharsets.UTF_8);
Assert.assertEquals("Hello world", responseText.trim());
}
from adblib.
Related Issues (19)
- Usage guide HOT 3
- How to push, pull, install commands ?
- New version HOT 2
- Wireless Debugging HOT 10
- What is the destination of 'AdbStream object corresponding to the specified destination'? HOT 4
- Does this method support the ability of bugreport
- the result of stream read contains some special character? HOT 1
- OutOfMemoryError HOT 1
- delay in commands
- Re-prompt to allow USB debugging HOT 2
- adb root
- adb root
- Add Kotlin and Flutter support
- hang for shell:dumpsys window windows
- Can the "pull" instruction be used
- Call ctrl+c on remote device? HOT 7
- Get STDOUT and STDERR separately, and exit code of command HOT 4
- Question HOT 11
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 adblib.