Spawning an independent thread or process in Ruby

后端 未结 2 1191
时光取名叫无心
时光取名叫无心 2021-02-15 18:38

I may be approaching this in the wrong direction, so any help would be appreciated.

I have a Ruby script which, amongst other things, starts up an executable. I want to

相关标签:
2条回答
  • 2021-02-15 18:45

    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
    
    0 讨论(0)
  • 2021-02-15 18:49

    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.

    0 讨论(0)
提交回复
热议问题