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 m Z m Z e re d d l m Z m Z m
Z
m Z n e j d e d � � Z e e e d � Z d � Z d � Z d � Z d S(
i����Ni ( t log_utilst utils( t 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
| � � � | | | 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 commandt catch_stdoutt catch_stderrR R R t pt stdout_capturedt stderr_capturedt code( ( s3 /usr/libexec/kcare/python/kcarectl/process_utils.pyt run_command s ! (c C s t | d t �\ } } } | S( NR# ( R) t True( t argst _R ( ( s3 /usr/libexec/kcare/python/kcarectl/process_utils.pyt check_output<