Don't ask to ask, just ask | |
PerlMonks |
Read STDOUT from Win32::Job while process is runningby Dirk80 (Pilgrim) |
on Mar 08, 2012 at 16:04 UTC ( [id://958489]=perlquestion: print w/replies, xml ) | Need Help?? |
Dirk80 has asked for the wisdom of the Perl Monks concerning the following question: Hello, I've looked at this post and it is working fine: http://www.perlmonks.org/?node=471412. I extended the example of BrowserUk so that I have a Cancel Button which then kills the process, but does not exit the application. And I have a start button which again starts it. But to my problem. My process is unfortunately not that simple. It also creates subprocesses. Because I'm in a Win32 environment the only way I found to be sure that the process and its subprocesses are killed completely was to use Win32::Job. But I don't know how to read from STDOUT while the process is running. Here a code snippet without Win32::Job:
How could I do the same with Win32::Job? The run function is blocking, so I think that I have to use the watch function. But already at the spawning I don't know how to fill the option "stdout" and how then to capture the output of the process while it is running when I try it with Win32::Job. So to summarize my problem. I'm here in a Win32 environment. I have to be able to kill a process tree. But I also want to read STDOUT from the created process while it is running. What are my options? My idea was to use Win32::Job because it is then very easy to kill the entire process tree. But this lead me to the problem that I don't know how to read the output while the process is running. Thank you alot for your help.
Back to
Seekers of Perl Wisdom
|
|