Returning data from forked processes

后端 未结 7 850
别那么骄傲
别那么骄傲 2020-12-08 14:37

If I do

Process.fork do 
  x 
end 

how can I know what x returned (e.g. true/fase/string) ?

(Writing to a file/database is not an

相关标签:
7条回答
  • 2020-12-08 15:38

    The fork communication between two Unix processes is mainly the return code and nothing more. However, you could open a filedescriptor between the two processes and pass data between the processes over this filedescriptor: this is the normal Unix pipe way.

    If you would pass Marshal.dump() and Marshal.load() values, you could easily pass Ruby objects between those Ruby processes.

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