在Windows中使用带有Ruby的fork

Rya*_*wis 11 ruby

当我Kernel.fork()在Windows上调用时,出现此错误:

!! Unexpected error while processing request: fork() function is unimplemented on this machine
Run Code Online (Sandbox Code Playgroud)

在Windows上有没有另一种方法来分叉?

小智 7

尝试spawn()- 它是为Windows实现的.


ASh*_*lly 4

虽然 Windows 操作系统不支持 fork,但win32-process gem似乎支持替代品。显然与 unix 版本有一些差异,请参阅这个问题:fork with Ruby 1.8 and Windows