summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-12 10:48:35 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-12 10:48:35 +0000
commit425aba72f5683ed9ec417b739629c6e57f43ebe0 (patch)
tree9d2fd568fc9fb4b226e82e37ae35233c6916d971 /eval.c
parenta5a6eec411cff80d8d79d3fdf0e81b0ee0866698 (diff)
downloadruby-425aba72f5683ed9ec417b739629c6e57f43ebe0.tar.gz
ruby-425aba72f5683ed9ec417b739629c6e57f43ebe0.tar.xz
ruby-425aba72f5683ed9ec417b739629c6e57f43ebe0.zip
* eval.c (ruby_run_node): if an exception occurred in ruby_option,
the result is not executable. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/eval.c b/eval.c
index 9b5e015b3..26c10c16c 100644
--- a/eval.c
+++ b/eval.c
@@ -216,23 +216,33 @@ ruby_stop(int 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);
}