add check that stdout is piped