Here is the progression of events... (1) I have an open logfile, (2) I start a process using Win32::Process::Create, (3) I "Wait" midway through process execution time, then (4) print other stuff to the logfile.
I need to collect and print the output started at step 2 to the logfile. I don't mind using a temporary file for storage...but prefer to capture data in memory. How do I do either of these? I'm thinking simple redirection to a file in the Process::Create( ) call won't work...but have not tried it.
sub call_it
{
# ...
$proc = execute_child($profile);
proc->Wait (60 * 1000) # wait 1 minute
print_file_sizes($profile)
; // prints some other data to the open logfile
# ...
}
sub execute_child
{
# ...
Win32::Process::Create ($ProcessObj2, $proc_fname, "$PROC_NAME -int $interval -samples 3",
0, NORMAL_PRIORITY_CLASS, "." );
# $PROC_NAME runs for 2 minutes - output normally goes to stdout ... its a command line process.
# I would like to capture this output somehow...?
# ...
return $ProcessObj2;
}
Start Free Trial