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
49653b81
Commit
49653b81
authored
Nov 30, 2019
by
KOBAYASHI Shuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Quit `mruby -v` immediately if no program is given for Ruby compatibility
parent
5eb08a0d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
mrbgems/mruby-bin-mruby/bintest/mruby.rb
mrbgems/mruby-bin-mruby/bintest/mruby.rb
+6
-0
mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
+9
-2
No files found.
mrbgems/mruby-bin-mruby/bintest/mruby.rb
View file @
49653b81
...
...
@@ -128,6 +128,12 @@ assert('mruby -r option (file not found)') do
assert_mruby
(
""
,
/\A.*: Cannot open library file: .*\n\z/
,
false
,
%w[-r _no_exists_]
)
end
assert
(
'mruby -v option'
)
do
ver_re
=
/\Amruby \d+\.\d+\.\d+ \(\d+-\d+-\d+\)\n/
assert_mruby
(
/
#{
ver_re
}
\z/
,
""
,
true
,
%w[-v]
)
assert_mruby
(
/
#{
ver_re
}
^[^\n]*NODE.*\n:end\n\z/m
,
""
,
true
,
%w[-v -e p(:end)]
)
end
assert
(
'mruby --verbose option'
)
do
assert_mruby
(
/\A[^\n]*NODE.*\n:end\n\z/m
,
""
,
true
,
%w[--verbose -e p(:end)]
)
end
...
...
mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
View file @
49653b81
...
...
@@ -14,6 +14,7 @@ struct _args {
mrb_bool
mrbfile
:
1
;
mrb_bool
check_syntax
:
1
;
mrb_bool
verbose
:
1
;
mrb_bool
version
:
1
;
mrb_bool
debug
:
1
;
int
argc
;
char
**
argv
;
...
...
@@ -180,7 +181,10 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
}
}
else
if
(
strcmp
(
opt
,
"v"
)
==
0
)
{
if
(
!
args
->
verbose
)
mrb_show_version
(
mrb
);
if
(
!
args
->
verbose
)
{
mrb_show_version
(
mrb
);
args
->
version
=
TRUE
;
}
args
->
verbose
=
TRUE
;
}
else
if
(
strcmp
(
opt
,
"version"
)
==
0
)
{
...
...
@@ -203,7 +207,10 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
argc
=
opts
->
argc
;
argv
=
opts
->
argv
;
if
(
args
->
cmdline
==
NULL
)
{
if
(
*
argv
==
NULL
)
args
->
rfp
=
stdin
;
if
(
*
argv
==
NULL
)
{
if
(
args
->
version
)
exit
(
EXIT_SUCCESS
);
args
->
rfp
=
stdin
;
}
else
{
args
->
rfp
=
strcmp
(
argv
[
0
],
"-"
)
==
0
?
stdin
:
fopen
(
argv
[
0
],
args
->
mrbfile
?
"rb"
:
"r"
);
...
...
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