Loading ...
Sorry, an error occurred while loading the content.

Win32::Process::Create() - how to capture process output

Expand Messages
  • Debadarshy Dash
    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
    Message 1 of 1 , Apr 26, 2006
    • 0 Attachment
      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;
      }

      Regards
      Dev


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.