Skip to content
Advertisement

Asyncio stream process data with pipe between two subprocesses

Hello I can’t find a solution for the example here. I found https://stackoverflow.com/a/36666420/6089311 but there is no stream reading.

I’d like to run two subprocesses independent of python program (running in the background). The first subprocess feeds the second process through the pipe and I want to do some processing with the stdout lines by stream way.

The example bellow is blocked but I don’t know why:

JavaScript

Advertisement

Answer

Code works for me if I move close() in places like in your link.

But probably it is not what you expect.

JavaScript

Eventually I can close read later but I have to close write before for-loop.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement