summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mrblib/kernel.rb4
-rw-r--r--test/io.rb4
2 files changed, 8 insertions, 0 deletions
diff --git a/mrblib/kernel.rb b/mrblib/kernel.rb
index 11ac5785f..484b50160 100644
--- a/mrblib/kernel.rb
+++ b/mrblib/kernel.rb
@@ -1,4 +1,8 @@
module Kernel
+ def self.`(cmd)
+ IO.popen(cmd) { |io| io.read }
+ end
+
def open(file, *rest, &block)
raise ArgumentError unless file.is_a?(String)
diff --git a/test/io.rb b/test/io.rb
index 727c67303..315f3ea79 100644
--- a/test/io.rb
+++ b/test/io.rb
@@ -232,6 +232,10 @@ assert('IO#fileno') do
io.closed?
end
+assert('`cmd`') do
+ assert_equal `echo foo`, "foo\n"
+end
+
assert('IO TEST CLEANUP') do
assert_nil MRubyIOTestUtil.io_test_cleanup
end