summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-19 03:02:47 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-19 03:02:47 +0000
commit6b6368158dd2556007c036e4f01bf45fec2039f0 (patch)
tree66b3088557a9ed0c6e7b68760fbc77622d9b7ced /iseq.c
parent9b5c2baae046fc943cd31279e325d59f13f54b3b (diff)
merge revision(s) 56267,56268: [Backport #12943]
based on a patch provided by Aaron Patterson. assertions.rb: success option * test/lib/test/unit/assertions.rb (assert_in_out_err): add success option to check the exit status. * iseq.c (iseqw_s_compile_file): deal with syntax error as well as compile, and should not abort when rescued. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/iseq.c b/iseq.c
index e679108558..797473e070 100644
--- a/iseq.c
+++ b/iseq.c
@@ -812,8 +812,7 @@ static VALUE
iseqw_s_compile_file(int argc, VALUE *argv, VALUE self)
{
VALUE file, line = INT2FIX(1), opt = Qnil;
- VALUE parser;
- VALUE f;
+ VALUE parser, f, exc = Qnil;
NODE *node;
const char *fname;
rb_compile_option_t option;
@@ -827,8 +826,10 @@ iseqw_s_compile_file(int argc, VALUE *argv, VALUE self)
parser = rb_parser_new();
node = rb_parser_compile_file(parser, fname, f, NUM2INT(line));
+ if (!node) exc = GET_THREAD()->errinfo;
rb_io_close(f);
+ if (!node) rb_exc_raise(exc);
make_compile_option(&option, opt);