From: Cong Wang <xiyou.wangcong@gmail.com>
To: Dave Jones <davej@redhat.com>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: 3.5.rc2 tty buffering bug ?
Date: Fri, 15 Jun 2012 18:32:54 +0800 [thread overview]
Message-ID: <CAM_iQpV4WOSafe8X9pjV++CUJyb30VDOVVKOiusA9OxGyj6CTw@mail.gmail.com> (raw)
In-Reply-To: <20120614161331.GA29687@redhat.com>
On Fri, Jun 15, 2012 at 12:13 AM, Dave Jones <davej@redhat.com> wrote:
> but when redirected to a file, sometimes it prints what we expect, but other times
> (if the child exits first) it seems to print..
>
> begin
> child
> end
> begin
> parent
> end
>
>
> How does 'begin' get printed a second time ?
>
setbuf(3) said:
"
Normally all files are block buffered. [...]
If a stream refers to a terminal (as stdout normally does) it is line buffered.
The standard error stream stderr is always unbuffered by default.
"
So when you redirect stdout to a file, "begin\n" is buffered too, both
in child and in parent.
prev parent reply other threads:[~2012-06-15 10:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-14 16:13 Dave Jones
2012-06-14 16:22 ` Dave Jones
2012-06-14 16:30 ` Andreas Schwab
2012-06-14 16:41 ` Alan Cox
2012-06-15 10:32 ` Cong Wang [this message]
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=CAM_iQpV4WOSafe8X9pjV++CUJyb30VDOVVKOiusA9OxGyj6CTw@mail.gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=davej@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®