fork download
  1. something = {
  2. "moo" => "meh",
  3. "foobar" => IO.popen('echo foo; exit 0'){|p|x=p.read.chomp;p.close;$?==0?x:fail},
  4. "foo" => "bar",
  5. }
  6.  
  7. require 'pp'
  8. pp something
  9.  
Success #stdin #stdout 0.01s 6628KB
stdin
Standard input is empty
stdout
{"moo"=>"meh", "foobar"=>"foo", "foo"=>"bar"}