windows 你如何在 Perl 中启动后台进程?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5481986/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do you start a background process in Perl?
提问by pepsi
I'm trying to figure out how to start a background process in a perl script (on Windows). In other words, I don't want the script to wait for the child process to complete before regaining control. Is there an easy way to do this in just a few lines of code? I've looked at perldoc for the system command, but it doesn't seem to do what I want..
我想弄清楚如何在 perl 脚本(在 Windows 上)中启动后台进程。换句话说,我不希望脚本在重新获得控制权之前等待子进程完成。有没有一种简单的方法可以在短短几行代码中做到这一点?我已经查看了系统命令的 perldoc,但它似乎没有做我想要的..
回答by ysth
See system in perlport: "system(1,@args)
spawns an external process and immediately returns its process designator, without waiting for it to terminate...(Win32)"
请参阅perlport 中的系统:“system(1,@args)
产生一个外部进程并立即返回其进程指示符,而不等待它终止......(Win32)”
回答by shawnhcorey
Try using Win32::Job.
尝试使用Win32::Job。