GNU bug report logs - #12975
A puzzling issue with "tee".

Previous Next

Package: coreutils;

Reported by: liyu <yu.li <at> windriver.com>

Date: Fri, 23 Nov 2012 20:03:02 UTC

Severity: normal

Tags: notabug

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: liyu <yu.li <at> windriver.com>
To: 12975 <at> debbugs.gnu.org
Subject: bug#12975: A puzzling issue with "tee".
Date: Fri, 23 Nov 2012 17:09:34 +0800
Hello:

There is a issue puzzling me.
When I use the "tee" command, the log of a.out will lose if I use 
"ctrl+c" to kill it.

Steps:
======
(1). Complie source.
$ gcc test.c -Wall

(2). Run without "tee".
$ ./a.out
xxxxx
yyyyy
zzzzz
/*Tip: print between 'xxxxx and yyyyy' the program will sleep 3*/
appearance
----------
0 sec: print "xxxxx"
1 sec:
...
3 sec: print "yyyyy"
...
6 sec: print "zzzzz", program exit.

(3). Run with "tee".
$ ./a.out | tee ./test.log
xxxxx
yyyyy
zzzzz
appearance
----------
0 sec:
...
6 sec: print "xxxxx\n""yyyyy\n""zzzzz\n", program exit.

In step (3), before 6 sec input "ctrl + c", the log will lose.
I want to know how to let the log collect real-timely.


==================================
/*File name: test.c*/

#include <stdio.h>
#include <unistd.h>

int main(void)
{
        printf("xxxxx\n");

        sleep(3);
        printf("yyyyy\n");

        sleep(3);
        printf("zzzzz\n");


        return 0;
}
==================================


Regards,
colin




This bug report was last modified 12 years and 186 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.