Added function to execute command and stream the output to a file like object.  Function also checks the return value and throws an error if it's non-zero, like check_call.