Search code examples
multithreadingperlprocessfork

How can I run a process from Perl and capture both output and return code?


I would like to run a separate process in Perl (a command line PHP script). I would like to capture this processes output AND return code. Optionally I would like to be able to terminate the process and move on if the process takes longer than N seconds. What should I look into?


Solution

  • You can try IPC::Run.

    IPC::Run - system() and background procs w/ piping, redirs, ptys (Unix, Win32)