Thing is that you do not redirect, you capture the streams.
So if you capture out, you need to read the output and close it. The return value of close will then tell you the right exit code.
Thing is that you do not redirect, you capture the streams.
So if you capture out, you need to read the output and close it. The return value of close will then tell you the right exit code.