X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/fbb92a858ba6b30b8110c0f3aa05e9376e4fe418..485fa064f8388272fe00ebfd29e4babf6dfed019:/test/runpty.c diff --git a/test/runpty.c b/test/runpty.c index 4ceb1fee..1585df94 100644 --- a/test/runpty.c +++ b/test/runpty.c @@ -24,7 +24,7 @@ int main(int argc, char *argv[]) { int master_in, master_out, slave, cc, status; - time_t starttime; + time_t starttime, now; const char *slavename; pid_t child; unsigned char readbuf[1024]; @@ -114,6 +114,8 @@ main(int argc, char *argv[]) execvp(argv[2], argv + 2); fprintf(stderr, "execvp(%s) failed: %s\n", argv[2], strerror(errno)); + exit(1); + } else if (child < 0) { fprintf(stderr, "fork() failed: %s\n", strerror(errno)); exit(1); @@ -167,8 +169,10 @@ main(int argc, char *argv[]) } } - if (time(NULL) >= starttime + COMMAND_TIMEOUT) { - fprintf(stderr, "Command execution timed out\n"); + now = time(NULL); + if (now >= starttime + COMMAND_TIMEOUT) { + fprintf(stderr, "Command execution timed out: %ld to %ld: %d\n", + starttime, now, cc); break; } }