File: //usr/libexec/kcare/python/kcarectl/process_utils.pyc
�
��ic @ s� d d l Z d d l Z d d l Z d d l Z d d l m Z m Z e rw d d l m Z m
Z
m Z m Z m
Z
n e j d e d � � Z e e e e d � Z e d � Z d � Z d � Z d
� Z d S( i����Ni ( t log_utilst utils( t Anyt Listt Optionalt Tuplet Unionc C sq | p d } x9 | D]1 } t j j | | � } t j j | � r | Sq W| ri t d j | | � � � n d Sd S( Ns /usr/sbins /sbins /usr/bins /bins {0} could not be found at {1}( s /usr/sbins /sbins /usr/bins /bin( t ost patht joint isfilet Exceptiont formatt None( t namet pathst raise_exct itt fname( ( s3 /usr/libexec/kcare/python/kcarectl/process_utils.pyt find_cmd s
c C s( | r t j n d } | r$ t j n d } t j | d | d | d | �} | j � \ } } | j }
| d k r� t j | � } n | d k r� t j | � } n t j t
j d � j d | j d | d | d d j
| � � � | r|
rt j |
| � } | | _ | | _ | � n |
| | f S( Nt stdoutt stderrt shells�
Call result for `{cmd}`:
exit code {exit_code}
=== STDOUT ===
{stdout}
=== STDERR ===
{stderr}
=== END ===
t exit_codet cmdt ( t
subprocesst PIPER
t Popent communicatet
returncodeR t nstrR t logdebugt textwrapt dedentR R t CalledProcessErrort outputR ( t commandt catch_stdoutt catch_stderrR t checkR R t pt stdout_capturedt stderr_capturedt codet exc( ( s3 /usr/libexec/kcare/python/kcarectl/process_utils.pyt run_command s&