209: def shell(cmd, *args)
210: args = args.flatten.compact
211: cmd = cmd.to_s if cmd.is_a?(Symbol)
212:
213: tf = Tempfile.new(cmd)
214: cmd = Rye.prepare_command(cmd, args)
215: cmd << " 2>#{tf.path}"
216:
217: handle = IO.popen(cmd, "r")
218: stdout = handle.read.chomp
219: handle.close
220:
221: stderr = File.exists?(tf.path) ? File.read(tf.path) : ''
222: tf.delete
223:
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