redirect program output into a log file does not seem to work properly when there is sleep in the program
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bash (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Redirect does not seem to work properly when program uses a sleep. I used the following test program. It works well if I do not redirect the output If I redirect the output to a file, I won't see anything in the file. tail -f does not show me anything. I can do redirect if I remove the sleep. I am using 64bits 13.04 with 3.8.0-25-generic #37 kernel. bash version is version 4.2.45(1).
#include <stdio.h>
#include <sys/time.h>
#include <time.h>
int main()
{
struct timeval tv;
struct tm* ltm;
while(1)
{
sleep(1);
gettimeofday(&tv, NULL);
ltm = localtime(
printf("%s\n", asctime(ltm));
}
}
ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: bash 4.2-5ubuntu3
ProcVersionSign
Uname: Linux 3.8.0-25-generic x86_64
ApportVersion: 2.9.2-0ubuntu8.1
Architecture: amd64
Date: Thu Jun 27 11:59:39 2013
InstallationDate: Installed on 2013-04-02 (86 days ago)
InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Release amd64 (20121017.5)
MarkForUpload: True
ProcEnviron:
TERM=xterm
PATH=(custom, no user)
XDG_RUNTIME_
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: bash
UpgradeStatus: Upgraded to raring on 2013-06-23 (3 days ago)