summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'process.c')
-rw-r--r--process.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/process.c b/process.c
index a1c8ce8863..be60526a03 100644
--- a/process.c
+++ b/process.c
@@ -1334,8 +1334,9 @@ check_exec_redirect(VALUE key, VALUE val, VALUE options)
index = EXEC_OPTION_OPEN;
path = val;
FilePathValue(path);
- if ((FIXNUM_P(key) && (FIX2INT(key) == 1 || FIX2INT(key) == 2)) ||
- key == rb_stdout || key == rb_stderr)
+ if (TYPE(key) == T_FILE)
+ key = check_exec_redirect_fd(key);
+ if (FIXNUM_P(key) && (FIX2INT(key) == 1 || FIX2INT(key) == 2))
flags = INT2NUM(O_WRONLY|O_CREAT|O_TRUNC);
else
flags = INT2NUM(O_RDONLY);