--- check_run.c.orig	2020-01-12 03:06:59.992434700 +0100
+++ check_run.c.new	2020-01-12 04:40:42.224635800 +0100
@@ -28,6 +28,8 @@
 #include <stdarg.h>
 #include <signal.h>
 #include <setjmp.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 
 #include "check.h"
 #include "check_error.h"
@@ -486,6 +488,15 @@
         eprintf("Error in call to fork:", __FILE__, __LINE__ - 2);
     if(pid == 0)
     {
+char fn[256];
+int fd1, fd2;
+sprintf(fn, "%s.stdout", srunner_log_fname(sr));
+fd1 = open(fn, O_WRONLY|O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+dup2(fd1, 1);
+sprintf(fn, "%s.stderr", srunner_log_fname(sr));
+fd2 = open(fn, O_WRONLY|O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+dup2(fd2, 2);
+
         setpgid(0, 0);
         group_pid = getpgrp();
         tr = tcase_run_checked_setup(sr, tc);
