On Mon, 21 Jan 2002, Shlomi Fish wrote:

> On Sun, 20 Jan 2002, Aviram Jenik wrote:
>
> > Hi,
> >
> > I'm having the following programming program: I have an app (an external app
> > which I cannot modify), that sends info to stdout, which I want to capture.
> > If I run the app without redirection, I can see the output coming out
> > immediately sent out to the screen. To emphasize:
> > $ ./externalApp
> > line 1
> > line 2
> > line 3
> > ..
> >
> > However, if I redirect the input to a file, or pipe it into another app (my
> > own), the output only starts to show after ~4 minutes. There's no text
> > missing, it just appears 'late'.
> >
> > This is as if the external app forgot to 'flush' or something. Like I said,
> > I can't modify this external app and I have to work around it.
> >
>
> Seems that it forgot to flush. I think there are tools like Perl's
> Term::IO and Tcl/Tk's expect that can overcome this and be used to capture
> a program's output as soon as it is written. But I'm not sure.

As Aviram has mentioned in his reply

$ rpm -qf /usr/bin/unbuffer
expect-8.3.3-9.1mdk
$ cat /usr/bin/unbuffer
#!/usr/bin/expect --
# Description: unbuffer stdout of a program
# Author: Don Libes, NIST

eval spawn -noecho $argv
set timeout -1
expect

-- 
Tzafrir Cohen
mailto:[EMAIL PROTECTED]
http://www.technion.ac.il/~tzafrir


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to