Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
9dc875f2
Commit
9dc875f2
authored
Aug 23, 2013
by
Tomoyuki Sahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add `cmd` (command output expression).
parent
5e8021be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
mrblib/kernel.rb
mrblib/kernel.rb
+4
-0
test/io.rb
test/io.rb
+4
-0
No files found.
mrblib/kernel.rb
View file @
9dc875f2
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
)
...
...
test/io.rb
View file @
9dc875f2
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment