Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streaming output not receiving all input #85

Open
kevindmoore opened this issue Dec 3, 2022 · 5 comments
Open

Streaming output not receiving all input #85

kevindmoore opened this issue Dec 3, 2022 · 5 comments

Comments

@kevindmoore
Copy link

I'm using this package on a Flutter Mac app and am trying to stream Android adb logs.
When I run adb logcat from the terminal, I get different results than what I can in my app. I'm not sure if it just can't keep up with the stream or if it is skipping lines but there are lots of lines that are missing.
I'm using ShellLinesController and my shell looks like:
final shell =
Shell(throwOnError: false, stdout: controller.sink, verbose: false);
I then:
final args = shellArguments(arguments);
await shell.run(args);
My listen method is:
shellLinesController.stream.listen((event) {
sendPort.send(event);
});

(I am using an isolate)

@alextekartik
Copy link
Contributor

Thanks for the report. In fact I'm using it for the exact same purpose but on Linux. I've never noticed that but I have never tried in another isolate neither so I'll try to reproduce your issue. If you can easily try, does it happen also (dropped lines) when not running in an isolate ?

Also do you have a simple way to see the issue (my initial thinking: running logcat in a terminal and running it in another terminal with ShellLinesController and compare the results) ? Thanks !

@kevindmoore
Copy link
Author

So, I just went back to a non-isolate code sample and the output is still really different.
It seems very behind and still missing lines.
I'll now try with a terminal app.

@kevindmoore
Copy link
Author

Ok. Just wrote a command line sample with shell and it worked great. Not sure if there if Flutter is causing a delay in the stream?

@alextekartik
Copy link
Contributor

Puzzling indeed. I have added some tests for that here https://github.com/tekartik/process_run.dart/blob/master/test/shell_lines_controller_test.dart
and indeed it looks ok.

I also tried on flutter (macos and linux) and was able to stream in real time all the lines send by a fake logger. Of course using adb is a different context so I just wonder whether it is not adb that is removing/skipping some lines:

I don't know what else to try on my side, sorry. If you have a simple way for me to reproduce the issue, let me know !

@kevindmoore
Copy link
Author

I looked up my logcat buffer and it is much larger than those old posts. It must be a problem with trying to stream it to a TextField

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants