Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #88620
| Path | csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.009 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'convention.': 0.07; 'only,': 0.07; 'caller': 0.09; 'subject:Help': 0.11; 'descriptor.': 0.16; 'descriptors': 0.16; 'objects.': 0.16; 'only?': 0.16; 'open()': 0.16; 'really?': 0.16; 'simpson': 0.16; 'stderr': 0.16; 'stdout': 0.16; 'sys.stdout': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'shell': 0.22; 'stopping': 0.24; '(or': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message- id:@mail.gmail.com': 0.30; 'file': 0.32; 'open': 0.33; 'device': 0.34; 'subject:with': 0.35; 'usual': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'operating': 0.37; 'level': 0.37; 'initially': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'though,': 0.39; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'lower': 0.61; 'no.': 0.61; 'believe': 0.68; 'default': 0.69; '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=XfKkfIPsxvALPx0oDTqKYdslz0sHOJlPPirEyWtRP78=; b=gPGDVsShVK67r7TbqRN7P5E9S7f/s9j4cje4eRHtp/tmuS/OGmSRiIECk2Q3xOK93L b8iPvPj1oxTxUyhc3nK4v0Mau5Bt5kEDDGemxTYEDA5atVG9pTHAzC/qPHExLmiUJZ+Z xWdumHmlb2Es7OQWv4YJZYlzFnhzn7HFUsvlj2KI14/xL6TSi/VSOJU1ydIxgg3ql+m0 W85yHbZZ1ij4AR3PEV/rwECcyE49oAVZLPdjgp9qGmZDzXTfMf6PBIwa5C2cZlkYMuFn JUBUwdISjyk/0BFb5B6x3DBpipL6ly0c6km9mEj8kp57yO+AcQc3vglJ0V+fWmLWJsD1 x1qQ== |
| X-Received | by 10.43.38.144 with SMTP id ti16mr28987388icb.26.1428445765162; Tue, 07 Apr 2015 15:29:25 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <20150407220655.GA71015@cskk.homeip.net> |
| References | <CAPTjJmoQQ_4-hONHyEw9QTj-UbMN8yJpMOkEfRwFvAZeyiX8Aw@mail.gmail.com> <20150407220655.GA71015@cskk.homeip.net> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Tue, 7 Apr 2015 16:28:44 -0600 |
| Subject | Re: Help with pipes, buffering and pseudoterminals |
| To | Python <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 <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.119.1428445767.12925.python-list@python.org> (permalink) |
| Lines | 33 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1428445767 news.xs4all.nl 2951 [2001:888:2000:d::a6]:50360 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:88620 |
Show key headers only | View raw
On Tue, Apr 7, 2015 at 4:06 PM, Cameron Simpson <cs@zip.com.au> wrote: > On 07Apr2015 20:38, Chris Angelico <rosuav@gmail.com> wrote: >> >> On Tue, Apr 7, 2015 at 3:48 PM, Cameron Simpson <cs@zip.com.au> 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? > > > No. Have a look with lsof: > > lsof -p $$ > > in a terminal. sys.stdin and sys.stdout are distinct, uni-directional io objects. At a lower level though, the only thing stopping you from calling os.write on fd 0 or os.read on fd 1 or 2 is convention.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Help with pipes, buffering and pseudoterminals Ian Kelly <ian.g.kelly@gmail.com> - 2015-04-07 16:28 -0600
csiph-web