From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin@cygwin.com
Subject: Re: Why is stdin always a pipe?
Date: Sat, 21 Jul 2018 00:59:00 -0000 [thread overview]
Message-ID: <d9aa837e-a906-784d-d90b-1478c65c19db@SystematicSw.ab.ca> (raw)
In-Reply-To: <CAJ+sA06X2dvZtCr7B2rLOH615++eG+s5QsYVg-nOqRd_4HMZyQ@mail.gmail.com>
On 2018-07-20 07:17, João Eiras wrote:
>>> $ [[ -p /dev/stdin ]] && echo pipe || echo nopipe
>>> nopipe
>
> Interesting, it's always a pipe for me. What about ls ?
>
> $ ls -l /dev/stdin
> prw------- 1 user None 0 Jun 4 15:54 /dev/stdin
Are you using a terminal that does not provide a console interface?
That is a pipe; Cygwin terms look like this:
$ ll -go /dev/std*; ll -go /proc/self/fd/[012]; ll -go /dev/pty?
lrwxrwxrwx 1 15 May 14 2013 /dev/stderr -> /proc/self/fd/2
lrwxrwxrwx 1 15 May 14 2013 /dev/stdin -> /proc/self/fd/0
lrwxrwxrwx 1 15 May 14 2013 /dev/stdout -> /proc/self/fd/1
lrwxrwxrwx 1 0 Jul 20 08:18 /proc/self/fd/0 -> /dev/pty0
lrwxrwxrwx 1 0 Jul 20 08:18 /proc/self/fd/1 -> /dev/pty0
lrwxrwxrwx 1 0 Jul 20 08:18 /proc/self/fd/2 -> /dev/pty0
crw--w---- 1 136, 0 Jul 20 08:18 /dev/pty0
crw--w---- 1 136, 1 Jul 20 08:18 /dev/pty1
$ for fd in 0 1 2 3; do test -t $fd; echo fd $fd term $?; done
fd 0 term 0
fd 1 term 0
fd 2 term 0
fd 3 term 1
$ for f in /dev/{std*,pty?}; do test -p $f; echo file $f pipe $?; done
file /dev/stderr pipe 1
file /dev/stdin pipe 1
file /dev/stdout pipe 1
file /dev/pty0 pipe 1
file /dev/pty1 pipe 1
where ptys are terms and are not pipes.
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
next prev parent reply other threads:[~2018-07-20 14:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-20 13:17 João Eiras
2018-07-20 14:52 ` David Macek
2018-07-20 15:12 ` João Eiras
2018-07-21 0:59 ` Brian Inglis [this message]
2018-07-21 1:59 ` Heavenly Avenger
2018-07-21 2:31 ` João Eiras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d9aa837e-a906-784d-d90b-1478c65c19db@SystematicSw.ab.ca \
--to=brian.inglis@systematicsw.ab.ca \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).