Only redirect the output if not called from the commandline