A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-December/084179.html below:

[Python-Dev] Forking and pipes

[Python-Dev] Forking and pipes [Python-Dev] Forking and pipesAlexander Shigin shigin at rambler-co.ru
Tue Dec 9 20:35:16 CET 2008
В Втр, 09/12/2008 в 19:26 +0000, Lars Kotthoff пишет:
> Dear list,
> 
>  I recently noticed a python program which uses forks and pipes for
> communication between the processes not behaving as expected. The minimal
> example program:

If you write 
====
r, w = os.pipe()
os.write(w, 'foo')
pid = os.fork()
====

You'll get the same result as C program. Or if you use fdopen in C
program you'll get the same result as Python.

The problem with the example is libc buffering. If you say
write.flush(), buffer won't be shared with child process and you'll see
only one 'foo'.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4