[lug] Is there a way to get output once it's been redirected to /dev/null?

Jeffrey Haemer jeffrey.haemer at gmail.com
Fri Jun 25 17:07:35 MDT 2010


Jon & Jon/Zan,

Nicely diagnosed.  It doesn't write for over a minute.  If I either throw in
an fflush(stdout), or change it to fprintf(stderr, "hello, world\n")  [
stderr is unbuffered by default ], I see 'em all.

My developer can't change the source of the running, misbehaving, program,
but he can just be patient -- though not, it seems, by emulating me. :-)

On Fri, Jun 25, 2010 at 4:35 PM, Jonathan Corbet <corbet-bldrlug at lwn.net>wrote:

> On Fri, 25 Jun 2010 16:30:27 -0600
> Jeffrey Haemer <jeffrey.haemer at gmail.com> wrote:
>
> > Great idea, but I'm missing something.
> >
> > Here's the source for a sample program:
> >
> > #include <stdio.h>
> >
> > int main(void) {
> >   while (1) {
> >     printf("hello, world\n");
> >     sleep(1);
> >   }
> > }
>
> Either wait longer or put in an fflush(stdout); call.  My guess is that
> stdio is buffering the output into a nice bug chunk.
>
> jon
>



-- 
Jeffrey Haemer <jeffrey.haemer at gmail.com>
720-837-8908 [cell],  @goyishekop [twitter]
http://seejeffrun.blogspot.com [blog],
http://www.youtube.com/user/goyishekop [vlog]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20100625/d47f906d/attachment.html>


More information about the LUG mailing list