Charles-François Natali added the comment: > If stdout was closed before closing stderr, then stdout problems > could be reported, and that is what I would expect when using Python > this way.
To be consistent, we should also close stderr, and then we couldn't report any subsequent error. > os.fsync(1) helps, but only if preceeded by sys.stdout.flush() and it > seems a bit cumbersome. You should complain to the POSIX committee ;-) The thing is simply that if you want to make sure that data is committed (or get an error otherwise), you should call fsync() on the file descriptor. Just having close return 0 doesn't guarantee that data is committed, in the general case (NFS is a special case with its close-to-open cache consistency). > cat, grep, dd and echo close their stdout, why couldn't Python do this? bash, dmesg, ifconfig and many others don't. It could probably be possible, but I don't think the benefit is worth the trouble. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16635> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com