Detect when not writing to terminal and skip progress bar