Using getline to output into a pipe