summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/io.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/io.c b/src/io.c
index 4f7fd25f0..b72eeada6 100644
--- a/src/io.c
+++ b/src/io.c
@@ -351,6 +351,13 @@ fptr_finalize(mrb_state *mrb, struct mrb_io *fptr, int noraise)
}
}
+ if (fptr->pid != 0) {
+ pid_t pid;
+ do {
+ pid = waitpid(fptr->pid, NULL, 0);
+ } while (pid == -1 && errno == EINTR);
+ }
+
if (!noraise && n != 0) {
mrb_sys_fail(mrb, "fptr_finalize failed.");
}