lkml.org 
[lkml]   [2012]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: 3.5.rc2 tty buffering bug ?
From
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.


\
 
 \ /
  Last update: 2012-06-15 13:01    [W:2.182 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site