Spawning an independent thread or process in Ruby

独自空忆成欢 提交于 2019-12-03 12:51:37

detunized's answer should work on windows. This one is cross-platform:

pid = spawn 'some_executable'
Process.detach(pid) #tell the OS we're not interested in the exit status

I just tried and start doesn't block on Windows 7 x64 with Ruby 1.8.7.

system 'start notepad'
puts 'Exiting now...'

This is obviously Windows-specific.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!