HomePhabricator

procutil: introduce pseudo file object that just raises EBADF

Authored by yuja.

Description

procutil: introduce pseudo file object that just raises EBADF

This should be safer than closing underlying fd as the fd may be reused.

On Python 2, closed sys.stdin could be redirected to a random file having
fd=0, but we'd be better not copying this behavior.

Only readinto() and write() are implemented according to the following ABC
table. fileno() is not implemented since fd=0/1/2 may be assigned later
to other files.

https://docs.python.org/3/library/io.html#class-hierarchy

Details

Committed
yujaDec 18 2020, 9:10 PM
Parents
rHGa9765e0a461d: dispatch: gate against missing stdout/stderr
Branches
Unknown
Tags
Unknown