�
㦧b<- � � � d dl mZ d dlZd dlmZ d dlZd dlZd dlZd dlZd dl Z d dl
Z
d dlZd dlm
Z
d dlmZ dd�Zd � Zd
� Zd� Zd� Zdd�Zd� Zd� Zd� Zdd�Zd� Zd� Zdd�Zd� Zd� Zdej j ddfd�Z dd e!� � fd�Z"dS )� )�unicode_literalsN)�log)�options)�versionFTc �0 � |rt j }t j }nd }d }t j � � � }|r|� |� � t j | |||�� � }|� � � }|j r+|r)t j
� d| |j fz � � �t |� � dk s"|d r|d �
� � sdS |d �
� � � dd� � S )N)�stdout�stderr�envz%s returned %dr � �utf-8�replace)�
subprocess�PIPE�os�environ�copy�update�Popen�communicate�
returncode� distutils�errors�DistutilsError�len�strip�decode) �cmd�throw_on_error�bufferr
�out_location�err_location�newenv�output�outs �)/usr/lib/python3/dist-packages/pbr/git.py�_run_shell_commandr& |