如何从Perl运行一个进程并捕获输出和返回代码? [英] How can I run a process from Perl and capture both output and return code?

查看:112
本文介绍了如何从Perl运行一个进程并捕获输出和返回代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Perl(命令行PHP脚本)中运行一个单独的进程.我想捕获此过程的输出并返回代码. (可选)我希望能够终止该过程并继续进行,如果该过程花费的时间超过N秒.我应该看什么?

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?

推荐答案

您可以尝试

IPC :: Run-带有管道,重做,pty(Unix,Win32)的system()和后台处理程序

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

这篇关于如何从Perl运行一个进程并捕获输出和返回代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆