summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'error.c')
-rw-r--r--error.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/error.c b/error.c
index 8546d1a0cf..d54f43c539 100644
--- a/error.c
+++ b/error.c
@@ -710,9 +710,15 @@ exit_status(VALUE exc)
static VALUE
exit_success_p(VALUE exc)
{
- VALUE status = rb_attr_get(exc, rb_intern("status"));
- if (NIL_P(status)) return Qtrue;
- if (status == INT2FIX(EXIT_SUCCESS)) return Qtrue;
+ VALUE status_val = rb_attr_get(exc, rb_intern("status"));
+ int status;
+
+ if (NIL_P(status_val))
+ return Qtrue;
+ status = NUM2INT(status_val);
+ if (WIFEXITED(status) && WEXITSTATUS(status) == EXIT_SUCCESS)
+ return Qtrue;
+
return Qfalse;
}