aboutsummaryrefslogtreecommitdiff
path: root/src/libthread/texec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libthread/texec.c')
-rw-r--r--src/libthread/texec.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libthread/texec.c b/src/libthread/texec.c
index 87c3f77b..bcfabee6 100644
--- a/src/libthread/texec.c
+++ b/src/libthread/texec.c
@@ -5,11 +5,16 @@ extern int _threaddebuglevel;
void
doexec(void *v)
{
+ int fd[3];
char **argv = v;
-print("doexec\n");
- procexec(nil, argv[0], argv);
+ fd[0] = dup(0, -1);
+ fd[1] = dup(1, -1);
+ fd[2] = dup(2, -1);
+ threadexec(nil, fd, argv[0], argv);
+ print("exec failed: %r\n");
sendp(threadwaitchan(), nil);
+ threadexits(nil);
}
void
@@ -28,7 +33,7 @@ threadmain(int argc, char **argv)
proccreate(doexec, argv, 8192);
w = recvp(c);
if(w == nil)
- print("exec failed: %r\n");
+ print("exec/recvp failed: %r\n");
else
print("%d %lud %lud %lud %s\n", w->pid, w->time[0], w->time[1], w->time[2], w->msg);
threadexits(nil);