My question is very close to this question here with an additional constraint related to time-outs
I'm using Jenkins to start some automated testing and then to capture the stdout (and stderr) of the running tests. As I've answered there I have determined how to get the stdout and stderr to display once the tests have finished, however the method I describe prints everything in the terminal when the process ends it's execution, not as it goes.
My problem occurs because my test jobs are on a 15 minutes timeout (the test script can take 1.5 or more hours to run) if Jenkins does not see any activity on the output pipe. I do not wish to substantially increase this timeout because the tests can hang.
Is there a way to get the stdout and stderr streams of the child process created by psexec in the terminal window that psexec is running under in real time?
psexec is started by a batch script on the test machines, not being used over a network.
I've considered running psexec with the -d flag and piping the child process output to a file and then just running a loop in the batch script that waits for the process to finish, this seems to be rather more a hack and should be an option of last resort.
runas is not a good alternative as Jenkins needs to know when the test scripts are finished. I could do similar to what I've mentioned above with the PID and a wait loop, but that's still a hack.
I am also wondering if it might be possible to simply pass psexec's IO streams to the child and patch the output straight back through to Jenkins that way but I have no idea how to do this.