/
opt
/
gsutil
/
gslib
/
utils
/
__pycache__
/
up file
home
a +(Wg5 � @ sT d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZddlmZ dd � Z dS ) z(Helper functions for executing binaries.� )�absolute_import)�print_function)�division)�unicode_literalsN)� exceptionc C sp t j| t jt jd�}|�� \}}|dur:t|t�s:|�� }|durTt|t�sT|�� }|jdkrht� |��||fS )z�Runs external terminal command. Args: command_and_flags (List[str]): Ordered command and flag strings. Returns: (stdout (str|None), stderr (str|None)) from running command. Raises: OSError for any issues running the command. )�stdout�stderrNr ) � subprocess�Popen�PIPE�communicate� isinstance�str�decode� returncoder �ExternalBinaryError)Zcommand_and_flagsZcommand_processZcommand_stdoutZcommand_stderr� r �)/opt/gsutil/gslib/utils/execution_util.py�ExecuteExternalCommand s � r ) �__doc__� __future__r r r r r �gslibr r r r r r �<module> s