Properly detect noninteractive sessions