capture stdout, stderr and stdin