Fix color change issue during output redirection

When command output is redirected to a file, console info is not available to set the colors resulting in a crash.
This is fixed with this change.