The command I want to run takes a few minutes and returns lots of unimportant data. The important stuff returns in the first 10 or so lines of the output. What I want to do is run this command through exec(), kill the process after 30 seconds, but be able to get the output that was generated in those 30 seconds.
Using the popular function "PsExecute", I can set a timeout to 30 seconds. However, this does not allow me to get the results of the output.
I can't think of a way to do both kill the process after so many seconds, and return the output. Can this be done?