Home » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » capturing stdout/err/in of subprocess
Re: capturing stdout/err/in of subprocess [message #1761 is a reply to message #1760] |
Sat, 18 March 2006 08:47 |
|
mirek
Messages: 13980 Registered: November 2005
|
Ultimate Member |
|
|
lundman wrote on Fri, 17 March 2006 19:01 |
I must agree I am not quite following why you need to know if your pipe-child is listening or not. You'll know if the child has gone away (EPIPE). The whole line buffering and echo is a tty/terminal feature which you can disable with ioctl(), that is quite trivial.
|
Just to remind: we are trying to create own terminal here.
Quote: |
But if you create pipes to your child you need not worry about linemode/echo as it is direct without the tty/terminal layer.
|
Yes, that is why we need to implement echo/linemode to get the terminal/console equivalent
I am really not sure how to explain it, but the trouble is that terminal runs in "dialog" mode - child process prints something, then waits for input data, then again prints something, you simply need to know when it waits for input data in order to allow user enter them (I am describing user experience here, not implementation !)
You cannot allow user to enter the data all the time, at least that is not what terminals/consoles do...
Another attempt of explanation: You are implementing the terminal/console. You are executing the child process. User presses some key. How your terminal/console application should react to this event? If you would just echo it at the current output position, your characters would be "inlined" with child process output on the screen. And you need to echo that character somehow as it is terminal responsibility. (Of course, at some moment you will send characters down to the stdin pipe, but that is not what we are solving here).
The moral of the story probably is that you cannot implement the terminal just by redirecting stdin/stdout... (makes sense, curses or Win32 console functions seem to work on another level anyway).
Mirek
|
|
|
|
|
capturing stdout/err/in of subprocess
By: wilho on Mon, 13 March 2006 14:21
|
|
|
Re: capturing stdout/err/in of subprocess
By: mirek on Mon, 13 March 2006 14:50
|
|
|
Re: capturing stdout/err/in of subprocess
|
|
|
Re: capturing stdout/err/in of subprocess
By: mirek on Tue, 14 March 2006 09:22
|
|
|
Re: capturing stdout/err/in of subprocess
By: wilho on Tue, 14 March 2006 08:53
|
|
|
Re: capturing stdout/err/in of subprocess
|
|
|
Re: capturing stdout/err/in of subprocess
By: mirek on Tue, 14 March 2006 10:54
|
|
|
Re: capturing stdout/err/in of subprocess
|
|
|
Re: capturing stdout/err/in of subprocess
By: lundman on Tue, 14 March 2006 12:00
|
|
|
Re: capturing stdout/err/in of subprocess
By: mirek on Tue, 14 March 2006 12:04
|
|
|
Re: capturing stdout/err/in of subprocess
|
|
|
Re: capturing stdout/err/in of subprocess
By: mirek on Wed, 15 March 2006 09:59
|
|
|
Re: capturing stdout/err/in of subprocess
By: mr_ped on Fri, 17 March 2006 10:52
|
|
|
Re: capturing stdout/err/in of subprocess
By: mirek on Fri, 17 March 2006 12:08
|
|
|
Re: capturing stdout/err/in of subprocess
By: fudadmin on Fri, 17 March 2006 12:11
|
|
|
Re: capturing stdout/err/in of subprocess
By: mirek on Fri, 17 March 2006 12:23
|
|
|
Re: capturing stdout/err/in of subprocess
|
|
|
Re: capturing stdout/err/in of subprocess
By: mirek on Fri, 17 March 2006 23:25
|
|
|
Re: capturing stdout/err/in of subprocess
|
|
|
Re: capturing stdout/err/in of subprocess
By: lundman on Sat, 18 March 2006 01:01
|
|
|
Re: capturing stdout/err/in of subprocess
By: mirek on Sat, 18 March 2006 08:47
|
|
|
Re: capturing stdout/err/in of subprocess
By: wilho on Sat, 18 March 2006 14:33
|
|
|
Re: capturing stdout/err/in of subprocess
By: lundman on Sat, 18 March 2006 15:05
|
Goto Forum:
Current Time: Tue May 14 01:44:56 CEST 2024
Total time taken to generate the page: 0.03835 seconds
|