0
这个问题在STDIN喂数据给多个外部命令是有点像我以前的(回答)问题:如何红宝石
How to run multiple external commands in the background in ruby
但是,在这种情况下,我正在寻找一种方式来养活Ruby字符串标准输入到外部进程,像这样(下面的代码是无效的,但说明我的目标):
#!/usr/bin/ruby
str1 = 'In reality a relatively large string.....'
str2 = 'Another large string'
str3 = 'etc..'
spawn 'some_command.sh', :stdin => str1
spawn 'some_command.sh', :stdin => str2
spawn 'some_command.sh', :stdin => str3
Process.waitall
你不需要的。只是一个Thread.new应该工作。 – Luis 2011-01-14 11:21:30