Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #88573 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2015-04-07 20:38 +1000 |
| Last post | 2015-04-08 12:23 +1200 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Help with pipes, buffering and pseudoterminals Chris Angelico <rosuav@gmail.com> - 2015-04-07 20:38 +1000
Re: Help with pipes, buffering and pseudoterminals Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-04-08 12:23 +1200
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-04-07 20:38 +1000 |
| Subject | Re: Help with pipes, buffering and pseudoterminals |
| Message-ID | <mailman.85.1428403083.12925.python-list@python.org> |
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? 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
[toc] | [next] | [standalone]
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Date | 2015-04-08 12:23 +1200 |
| Message-ID | <cojanuFmscU1@mid.individual.net> |
| In reply to | #88573 |
Chris Angelico wrote: > 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? It depends entirely on how the process that forked your shell process set things up, but a quick experiment I just did in a MacOSX terminal window suggests that it's not really bothered about that distinction: sh-3.2$ echo foo >&0 foo -- Greg
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web