aboutsummaryrefslogtreecommitdiffstats
path: root/goruby.c
diff options
context:
space:
mode:
Diffstat (limited to 'goruby.c')
-rw-r--r--goruby.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/goruby.c b/goruby.c
index 5ac4c96d12..ddb62562d4 100644
--- a/goruby.c
+++ b/goruby.c
@@ -35,7 +35,11 @@ goruby_options(int argc, char **argv)
if ((isatty(0) && isatty(1) && isatty(2)) && (pipe(rw) == 0)) {
ssize_t n;
infd = dup(0);
- if (infd < 0) return NULL;
+ if (infd < 0) {
+ close(rw[0]);
+ close(rw[1]);
+ goto no_irb;
+ }
dup2(rw[0], 0);
close(rw[0]);
n = write(rw[1], cmd, sizeof(cmd) - 1);
@@ -46,6 +50,7 @@ goruby_options(int argc, char **argv)
return ret;
}
else {
+ no_irb:
return ruby_options(argc, argv);
}
}