Quantcast
Channel: Active questions tagged windows - Super User
Viewing all articles
Browse latest Browse all 9687

How to get the terminal output of a program over a pipe, in real time? [migrated]

$
0
0

I'm writing a graphical interface for a CLI application. For this purpose, I'd like to get its terminal output through a pipe in real time.

The issue is that while the content of the pipe is close enough to the terminal output, it only arrives in big chunks; sometimes, the entire output of the program arrives only when it terminates. When executing the program in a terminal, the output arrives in real time instead.

The "chunked" behavior occurred across different consumers (Python subprocess.Popen with varying configurations, redirect to a file and display with tail, pipe to cat), so it's unlikely to be an issue with a specific consumer.

Why does this chunking occur? Is there a way to flush the buffer of the application from Python? Is there some windows or python tool that emulates a terminal to the program and then pushes the output through a pipe?


Viewing all articles
Browse latest Browse all 9687