From: "Pedro CĂ´rte-Real" Date: 2006-06-01T00:30:40+09:00 Subject: Passing a string as stdin to a popen Say I have some content in a ruby string and I want to pass it as stdin input to a command. I then want to read the output. I tried this: IO.popen("mycommand", mode='r+') do |io| io.write mytext result = io.read end This resulted in a "Broken Pipe" exception. What's the correct way to do this? Thanks, Pedro.