add implementation of check_output that also prints lines to stdout as they come in