I'm trying to capture all output from an external interactive process to a log file.
For example, I would like perl to execute "cp -i file1 file2" and log the overwrite prompt and user input when file2 exists.
I have managed to find a solution by calling a system("cp -i file1 file2 2>&1 | tee out.log"); but as I require the exit code from the cp this isn't feasible :(