Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!ecngs!feeder2.ecngs.de!217.188.199.168.MISMATCH!takemy.news.telefonica.de!telefonica.de!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.038 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'linux,': 0.07; 'subject:file': 0.07; 'skip:/ 10': 0.09; 'symlink': 0.16; 'trusty': 0.16; 'wrote:': 0.18; 'seems': 0.21; 'equivalent': 0.26; 'possibly': 0.26; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'equivalent.': 0.31; 'this.': 0.32; 'linux': 0.33; 'received:google.com': 0.35; 'ubuntu': 0.36; 'shows': 0.36; 'two': 0.37; 'system,': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'itself': 0.39; 'use.': 0.39; 'to:addr:python.org': 0.39; 'read': 0.60; 'subject: & ': 0.68; '2015': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=XjpegXlRHuOwaqZ7jWnAXI9RunXmRpPbpEv+VQHbnk0=; b=TLOVBSrEevH5e4C6ex5A0nJ0dn9iU7k1iDFLO/qvUMpeu4iS3dQ2ZI5ytfTA+IpiCG VwMHi/rdRC61bTWLZxm/jHkeTZ3cAbwQ0+loClEKhsGkkoS/zZIdwnr9Vv3YnTnDrDS1 yiWBcxXnmQiVMIrRlWEkS4nWNXF+RE++cQI+PfUCVyeaefytq9fuyHfaF9X4WdFZ1BKw ow3E7TSS4CkeCn5NYp5SfVU7nyO48hapejQrhC7XcWnEceJNE1wHYD4MGs0Y4FcEqCIl klXYW15b1A8+ks6AmldNhZXjjOKfyTbc51FGKy9VgbClRwU2KsY8uxXkf7e7dLYTwEgE 4AfQ== X-Received: by 10.50.30.105 with SMTP id r9mr30187585igh.11.1432146684723; Wed, 20 May 2015 11:31:24 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Wed, 20 May 2015 12:30:44 -0600 Subject: Re: fork/exec & close file descriptors To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1432146694 news.xs4all.nl 2838 [2001:888:2000:d::a6]:37122 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:90973 On Tue, May 19, 2015 at 7:10 PM, Gregory Ewing wrote: >> On Tue, May 19, 2015 at 8:54 AM, Chris Angelico > > 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.