fork/exec & close file descriptors
Ian Kelly
ian.g.kelly at gmail.com
Wed May 20 14:30:44 EDT 2015
On Tue, May 19, 2015 at 7:10 PM, Gregory Ewing
<greg.ewing at canterbury.ac.nz> wrote:
>> On Tue, May 19, 2015 at 8:54 AM, Chris Angelico <rosuav at gmail.com
>> <mailto:rosuav at gmail.com>> wrote:
>>
>> On Linux (and possibly some other Unixes), /proc/self/fd may be of
>> use.
>
>
> On MacOSX, /dev/fd seems to be the equivalent of this.
Not a perfect equivalent. On Linux, ls -lF /proc/self/fd shows the
contents as symlinks, which is handy since you can just read the links
to see what they're pointing to. On OSX, ls -lF /dev/fd shows three
ttys and two directories.
Though I also note that on my Ubuntu Trusty system, /dev/fd is itself
a symlink to /proc/self/fd.
More information about the Python-list
mailing list