tekartik / process_run.dart

Process run helper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Windows Release] Bad state: StreamSink is bound to a stream

VergeDX opened this issue · comments

In windows release build, I noticed a wierd behavior: The first Future of await Shell().run() will stuck in waiting status.
But later Future of await Shell().run() can be done, but throws the Exception: Bad state: StreamSink is bound to a stream...
I make a demo for reproduce this bug: https://github.com/VergeDX/untitled/tree/demo

I'm using Flutter 2.0.6 (installed by choco), I also tried Flutter 2.2.0. But the bug still here.
I'm a noob for Flutter and English, If any information needed, please let me know.

I am having the very same issue, it happens only when running the .exe from flutter build. Running the app using flutter run --release does not present the bug.

Sorry I did not notice the issue. @VergeDX I cannot access your demo.

@savy-91 do you have some logs (yes I know logs could painful in release but sometimes print is a good debug options). Good if you can catch the exception and display the stacktrace.

I just verified and the same issue happens when building an .exe using flutter build windows --debug

So far the only exception I was able to catch was the one described above Bad state: StreamSink is bound to a stream. The first time Shell().run() is called though I get no exception.

If you have a Gitlab account @alextekartik I can share the source I am working on. It's a very simple project, not much more than a minimum reproducible example.

Oh sorry, I delete my demo repo because I switch to Process class in dart:io.
I originally thought that this repo isn’t being maintained... thanks for your reply.

@VergeDX No problem, I understand, process_run is just a wrapper around dart:io with some convenient helper regarding the environment and script command.

@savy-91 Thanks for the repo, I was able to reproduce. Indeed puzzling and I was able to reproduce the issue just by calling stdout.flush(). And calling it twice on Windows release (build) mode hangs... I guess this should be reported to the flutter team.
So the workaround I added is to remove calls to flush in windows release mode, which should not impact the behavior (it was in place to avoid having console output later). Can you try to update to process_run v0.12.1+1 just published?

I'm currently running 0.13.1 and also getting this same error when running either Debug or Release from the .exe files.

Running flutter build windows will work fine and the .exe version logs that error.