Mailinglist Archive: opensuse (1620 mails)

< Previous Next >
Re: [opensuse] I thought I knew the basics - "tee" not working as I expected
On 11/12/2014 10:13 AM, Greg Freemyer wrote:
Is there a way to force tee to flush it's buffers? (Or tee may not be
the problem.)

== details

I have an interactive program I want to capture the output of. It
only has one prompt, then it runs to completion

It's a python app. I'm running inside konsole and my basic command is:

python preg.py | tee output_file

I'm not getting any output in konsole nor in the output_file until the app
ends.

If I run it interactively, I get the prompt fine, but all the
resulting output spits up on the screen and it is multiple screens of
output.

I realize the program is not the greatest at creating savable output,
but I didn't write it!

Two things come to mind.

The first is that a pipe takes stdout and connects to stdin.
if the output of a program doesn't go to stdout or if it closes and
reopens its output or if it sends output to /dev/tty, then its not going
to stdout.

Yes it seems a crazy thing to do but there you are.

The second is to use 'script' and run in a sub shell and have the screen
output all saved.

Or perhaps not if the idiot program decided to send to /dev/tty ...

Can you look at the source?
You don't need to be a python programmer to recognise something like

... Open("/dev/tty ...




--
A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting frowned upon?

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups
References