[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12975: A puzzling issue with "tee".
From: |
liyu |
Subject: |
bug#12975: A puzzling issue with "tee". |
Date: |
Fri, 23 Nov 2012 17:09:34 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 |
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
- bug#12975: A puzzling issue with "tee".,
liyu <=