[issue43806] asyncio.StreamReader hangs when reading from pipe and other process exits unexpectedly

2021-12-05 Thread Marko
Marko added the comment: Thanks, takluyver! You are right. Synchronous code that I was comparing it to had os.close(ctx), but I forgot to add it in the async example, so I thought it was a bug. Closing this issue. -- resolution: -> not a bug stage: -> resolved status: open ->

[issue43806] asyncio.StreamReader hangs when reading from pipe and other process exits unexpectedly

2021-11-24 Thread Thomas Kluyver
Thomas Kluyver added the comment: In the example script, I believe you need to close the write end of the pipe in the parent after forking: cpid = os.fork() if cpid == 0: # Write to pipe (child) else: # Parent os.close(ctx) # Read from pipe This is the same with synchronous

[issue43806] asyncio.StreamReader hangs when reading from pipe and other process exits unexpectedly

2021-05-07 Thread Marko
Marko added the comment: @jaswdr Hm, this is was somewhat unexpected for me, since when reading directly from pipe, and EOF is sent. Timeout was somewhat awkward in my case, since I don't know when other process will start sending, and how long it would take. On the other hand, I use

[issue43806] asyncio.StreamReader hangs when reading from pipe and other process exits unexpectedly

2021-05-03 Thread Jonathan Schweder
Jonathan Schweder added the comment: @kormang this is an expected behaviour, this is a problem even for the OS level, just because it is impossible to know when the reader needs to stop waiting, the best option here is to implement some timeout mechanism. -- nosy: +jaswdr

[issue43806] asyncio.StreamReader hangs when reading from pipe and other process exits unexpectedly

2021-04-16 Thread Terry J. Reedy
Change by Terry J. Reedy : -- nosy: +asvetlov, yselivanov ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43806] asyncio.StreamReader hangs when reading from pipe and other process exits unexpectedly

2021-04-11 Thread Marko
(read_from_child()) -- components: Library (Lib) messages: 390778 nosy: kormang priority: normal severity: normal status: open title: asyncio.StreamReader hangs when reading from pipe and other process exits unexpectedly versions: Python 3.8 ___ Python

reading from pipe

2010-01-25 Thread Richard Lamboj
Hello, is there any solution to catch if a pipe has closed? Maybe the signal modul? For Simulation: #!/usr/bin/env python # -*- coding: utf-8 -*- import sys while True: line = sys.stdin.readline() sys.stdout.write(line) sys.stdout.flush() time cat /tmp/proxy.test |

Re: reading from pipe

2010-01-25 Thread Lutz Horn
Hi, Richard Lamboj schrieb: is there any solution to catch if a pipe has closed? Maybe the signal modul? Since sys.stdin is a file object, you can use sys.stdin.closed to check if it has been closed. Lutz -- http://mail.python.org/mailman/listinfo/python-list