ó
æNXc           @   sr   d  Z  d d l Z d d l Z d d l Z d d l m Z d d l m Z d „  Z d „  Z	 d „  Z
 d	 „  Z d S(
   sž  cli-specific implementation of process utilities.

cli - Common Language Infrastructure for IronPython. Code
      can run on any operating system. Check os.name for os-
      specific settings.

This file is only meant to be imported by process.py, not by end-users.

This file is largely untested. To become a full drop-in process
interface for IronPython will probably require you to help fill
in the details. 
iÿÿÿÿN(   t	   py3compati   (   t	   arg_splitc         C   sz   t  j j d ƒ j t j ƒ } xE | D]= } t j j | |  ƒ } t  j j	 j
 | ƒ r% t j | ƒ Sq% Wt d |  ƒ ‚ d S(   s,   Find the full path to a command using which.t   PATHs   command %r not foundN(   t   Systemt   Environmentt   GetEnvironmentVariablet   Splitt   ost   pathsept   patht   joint   IOt   Filet   ExistsR    t   bytes_to_strt   OSError(   t   cmdt   pathsR	   t   filename(    (    sR   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/_process_cli.pyt	   _find_cmd   s    c         C   sX   t  j j |  ƒ } t | _ t | _ t  j j j | _ t	 | _
 t  j j j | ƒ } d S(   sY   
    system(cmd) should work in a cli environment on Mac OSX, Linux,
    and Windows
    N(   R   t   Diagnosticst   ProcessStartInfot   Truet   RedirectStandardOutputt   RedirectStandardErrort   ProcessWindowStylet   Normalt   WindowStylet   Falset   UseShellExecutet   Processt   Start(   R   t   psit   reg(    (    sR   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/_process_cli.pyt   system"   s    			c         C   s‚   t  j j |  ƒ } t | _ t | _ t  j j j | _ t	 | _
 t  j j j | ƒ } | j } | j ƒ  } | j } | j ƒ  } | S(   s\   
    getoutput(cmd) should work in a cli environment on Mac OSX, Linux,
    and Windows
    (   R   R   R   R   R   R   R   R   R   R   R   R   R   t   StandardOutputt	   ReadToEndt   StandardError(   R   R    R!   t   myOutputt   outputt   myErrort   error(    (    sR   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/_process_cli.pyt	   getoutput/   s    					c         C   sK   y t  j j j |  ƒ t SWn) t  j k
 r2 t St  j k
 rF t SXd S(   s<   
    Check if a process with the given PID (pid) exists
    N(   R   R   R   t   GetProcessByIdR   t   InvalidOperationExceptiont   ArgumentExceptionR   (   t   pid(    (    sR   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/_process_cli.pyt	   check_pidA   s    (   t   __doc__t   clrR   R   t   IPython.utilsR    t   _process_commonR   R   R"   R*   R/   (    (    (    sR   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/_process_cli.pyt   <module>   s   				