Check for a terminal before using escapes