如何从 Windows 上的 Perl CGI 脚本派生后台进程? [英] How can I fork a background processes from a Perl CGI script on Windows?

查看:32
本文介绍了如何从 Windows 上的 Perl CGI 脚本派生后台进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows 上运行时,我在从 Perl CGI 脚本分叉进程时遇到了一些麻烦.主要问题似乎是在 Windows 上运行时模拟了fork",并且实际上似乎并没有创建新进程(只是当前进程中的另一个线程).这意味着等待进程完成的 Web 服务器(如 IIS)会继续等待,直到后台"进程完成.

I've had some trouble forking of processes from a Perl CGI script when running on Windows. The main issue seems to be that 'fork' is emulated when running on windows, and doesn't actually seem to create a new process (just another thread in the current one). This means that web servers (like IIS) which are waiting for the process to finish continue waiting until the 'background' process finishes.

有没有办法在 Windows 下从 CGI 脚本中分出后台进程?更好的是,是否有一个我可以调用的函数可以跨平台执行此操作?

Is there a way of forking off a background process from a CGI script under Windows? Even better, is there a single function I can call which will do this in a cross platform way?

(为了让生活变得更加困难,我真的很想要一种将分叉进程输出同时重定向到文件的好方法).

(And just to make life extra difficult, I'd really like a good way to redirect the forked processes output to a file at the same time).

推荐答案

如果你想以独立于平台的方式做到这一点,Proc::Background 可能是最好的方法.

If you want to do this in a platform independent way, Proc::Background is probably the best way.

这篇关于如何从 Windows 上的 Perl CGI 脚本派生后台进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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