repo.or.cz
/
mruby.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
Add 'mrbgems/mruby-io/' from commit '3c8e1f94c44252c836f79a48bb17726da28e2756'
[mruby.git]
/
mrbgems
/
mruby-io
/
mrblib
/
kernel.rb
blob
373b76f98c050bb93b60f3244ca5dd8bd0c76fa8
1
module Kernel
2
def `(cmd)
3
IO.popen(cmd) { |io| io.read }
4
end
5
6
def open(file, *rest, &block)
7
raise ArgumentError unless file.is_a?(String)
8
9
if file[0] == "|"
10
IO.popen(file[1..-1], *rest, &block)
11
else
12
File.open(file, *rest, &block)
13
end
14
end
15
end