Detect output going to terminal