From 511e757cd868a4207bddeffbdf127ad483fcfa80 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 12 Oct 2009 10:48:35 +0000 Subject: * eval.c (ruby_run_node): if an exception occurred in ruby_option, the result is not executable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ eval.c | 28 +++++++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63ac6b9c31..0dc8b80ecd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Oct 12 19:48:33 2009 Nobuyoshi Nakada + + * eval.c (ruby_run_node): if an exception occurred in ruby_option, + the result is not executable. + Mon Oct 12 05:51:11 2009 NARUSE, Yui * regparse.c (fetch_token): warn invalid back reference diff --git a/eval.c b/eval.c index 9b5e015b35..26c10c16c8 100644 --- a/eval.c +++ b/eval.c @@ -215,24 +215,34 @@ ruby_stop(int ex) exit(ruby_cleanup(ex)); } +int +ruby_executable_node(void *n, int *status) +{ + VALUE v = (VALUE)n; + int s; + + switch (v) { + case Qtrue: s = EXIT_SUCCESS; break; + case Qfalse: s = EXIT_FAILURE; break; + default: + if (!FIXNUM_P(v)) return TRUE; + s = FIX2INT(v); + } + if (status) *status = s; + return FALSE; +} + int ruby_run_node(void *n) { + int status; + if (!ruby_executable_node(n, &status)) return status; return ruby_cleanup(ruby_exec_node(n)); } int ruby_exec_node(void *n) { - VALUE v = (VALUE)n; - - switch (v) { - case Qtrue: return EXIT_SUCCESS; - case Qfalse: return EXIT_FAILURE; - } - if (FIXNUM_P(v)) { - return FIX2INT(v); - } ruby_init_stack((void *)&n); return ruby_exec_internal(n); } -- cgit v1.2.3