如何从 Perl 启动程序作为一个单独的进程? [英] How to launch program from Perl as a separate process?

查看:43
本文介绍了如何从 Perl 启动程序作为一个单独的进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
如何在 Perl 中触发并忘记进程?

我正在寻找一种从 Perl 脚本调用新进程的方法,这将使启动的程序和从中启动的 Perl 脚本同时工作.

I'm looking for a way to invoke a new process from a Perl script, that will let a launched program and a Perl script, from which it's launched, proceed to work concurrently.

该计划是 SIPp,如果它很重要.

The program is SIPp, if it's important.

谢谢.

推荐答案

如果你真的想要单独的进程,那么另一个选择是 forkexec.

If you actually want separate processes, then another option is fork and exec.

if (fork) {
  # In the parent program
  # Continue as usual
  ...
} else {
  # In the new child program
  # Replace with another program
  exec $some_other_program;
}

这篇关于如何从 Perl 启动程序作为一个单独的进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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