# File lib/rye.rb, line 209
209:   def shell(cmd, *args)
210:     args = args.flatten.compact
211:     cmd = cmd.to_s if cmd.is_a?(Symbol)
212:     # TODO: allow stdin to be sent to the cmd
213:     tf = Tempfile.new(cmd)
214:     cmd = Rye.prepare_command(cmd, args)
215:     cmd << " 2>#{tf.path}" # Redirect STDERR to file. Works in DOS too.
216:     # Deal with STDOUT
217:     handle = IO.popen(cmd, "r")
218:     stdout = handle.read.chomp
219:     handle.close
220:     # Then STDERR
221:     stderr = File.exists?(tf.path) ? File.read(tf.path) : ''
222:     tf.delete
223:     # Create the response object
224:     rap = Rye::Rap.new(self)
225:     rap.add_stdout(stdout || '')
226:     rap.add_stderr(stderr || '')
227:     rap.add_exit_status($?)
228:     rap
229:   end