Commit 9dc875f2 authored by Tomoyuki Sahara's avatar Tomoyuki Sahara

add `cmd` (command output expression).

parent 5e8021be
module Kernel module Kernel
def self.`(cmd)
IO.popen(cmd) { |io| io.read }
end
def open(file, *rest, &block) def open(file, *rest, &block)
raise ArgumentError unless file.is_a?(String) raise ArgumentError unless file.is_a?(String)
......
...@@ -232,6 +232,10 @@ assert('IO#fileno') do ...@@ -232,6 +232,10 @@ assert('IO#fileno') do
io.closed? io.closed?
end end
assert('`cmd`') do
assert_equal `echo foo`, "foo\n"
end
assert('IO TEST CLEANUP') do assert('IO TEST CLEANUP') do
assert_nil MRubyIOTestUtil.io_test_cleanup assert_nil MRubyIOTestUtil.io_test_cleanup
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment