3 ms·
Fair enough. Simply reading from the file descriptor won't work since some of the output will be redirected to the original process depending on who reads the n
by mistaken 11y ago
Fair enough. Simply reading from the file descriptor won't work since some of the output will be redirected to the original process depending on who reads the next character first. The solution is to attach to the process using ptrace and then reditrect the stdout using dup. There is an example on how to do this with gdb on stackoverflow (http://stackoverflow.com/questions/1323956/how-to-redirect-output-of-an-already-running-process http://stackoverflow.com/questions/1323956/how-to-redirect-o...) This would give a nice performance boost if you could implement this in your code.