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:
#!/usr/bin/perl use strict; use warnings; $|=1; open PROC, 'perl -le"$|=1; print and select(undef,undef,undef,0.1) for 1 .. 1 +000" |' or die $!; while( <PROC> ) { print $_; } close PROC;
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.
In reply to Read STDOUT from Win32::Job while process is running by Dirk80
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |