Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed1.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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'only,': 0.07; 'caller': 0.09; 'cc:addr:python-list': 0.11; 'subject:Help': 0.11; 'descriptor.': 0.16; 'descriptors': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'only?': 0.16; 'open()': 0.16; 'really?': 0.16; 'simpson': 0.16; 'stderr': 0.16; 'stdout': 0.16; 'unix,': 0.16; 'wrote:': 0.18; 'shell': 0.22; 'cc:addr:python.org': 0.22; 'of.': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'dos': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'file': 0.32; 'open': 0.33; 'device': 0.34; 'maybe': 0.34; 'subject:with': 0.35; 'usual': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'operating': 0.37; 'initially': 0.38; 'massive': 0.38; 'pm,': 0.38; 'here': 0.66; 'believe': 0.68; 'default': 0.69; '2015': 0.84; 'grew': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=dBdDp4e7NXsX/+CS79WW3FYK7bDya5rTe6kSqhEEUMQ=; b=PO1cC48GiD6wyt9B6zz4a4sWMurNiTe8mRJJhOW/Umla/xR6XDqpGYgq9TxfC6fMuq MVsiFuKBsQxI08Mh7Pe1EI2r2bcb5YOczvOmNoKziSjoxffYEZjPCQIB3mUBNzYPkfuc 8StsnCiUgJqZDQgHWHODkMfuPlErTjt6Q9d8wMZyiLUFfrxGRlklhuAh4B24aEMprf9N CALcCqOEeDyddcDZ6vfAwKpAL4KNzi2mcRrvtHrqr7WZIK5LgfHYxhDreEWa6ZaGjCbD VpN3FmvYjdgndslm3jiEFLVLahr6UTiNXMCqundHsPchkLW26AROunR9c61q+9ge9RAF CPLw== MIME-Version: 1.0 X-Received: by 10.107.160.212 with SMTP id j203mr29486468ioe.43.1428403080746; Tue, 07 Apr 2015 03:38:00 -0700 (PDT) In-Reply-To: <20150407054803.GA80257@cskk.homeip.net> References: <20150407054803.GA80257@cskk.homeip.net> Date: Tue, 7 Apr 2015 20:38:00 +1000 Subject: Re: Help with pipes, buffering and pseudoterminals From: Chris Angelico Cc: "python-list@python.org" 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: 1428403083 news.xs4all.nl 2906 [2001:888:2000:d::a6]:52340 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88573 On Tue, Apr 7, 2015 at 3:48 PM, Cameron Simpson wrote: > The operating system arranges the commection of the shell to the terminal. > Your usual program has by default a stdin, stdout and stderr. These are > _all_ the same file handle, duplicated to each of the three file descriptors > 0, 1 and 2 respectively. On the operating system side, the OS has performed > _one_ open() call on the terminal device and handed the caller a single file > descriptor. The caller then calls dup() (or modernly, dup2()) to present the > open terminal as stdin, stdout and stderr. Really? I can believe that stdout and stderr are initially duplicates, but stdin as well? Isn't stdin opened for reading only, and stdout/stderr for writing only? I grew up on DOS and OS/2, not on Unix, so maybe there's a massive simplification here that I'm not aware of. That'd be pretty clean and tidy if what you say is the case! ChrisA