check if stdout is TTY before trying to clearLine or cursorTo(0)