
    &eV                         d Z ddlZddlZddlZej        dk    rddlmZmZmZm	Z	 n$ej        dk    rddl
mZmZmZm	Z	 nddlmZmZmZm	Z	 ddlmZmZmZ  G d d	e          Zd
 Zd ZdS )z0
Utilities for working with external processes.
    Nwin32   )system	getoutput	arg_split	check_pidcli)getoutputerrorget_output_error_codeprocess_handlerc                       e Zd ZdS )FindCmdErrorN)__name__
__module____qualname__     5lib/python3.11/site-packages/IPython/utils/process.pyr   r      s        Dr   r   c                 V    t          j        |           }|t          d| z            |S )a  Find absolute path to executable cmd in a cross platform manner.

    This function tries to determine the full path to a command line program
    using `which` on Unix/Linux/OS X and `win32api` on Windows.  Most of the
    time it will use the version that is first on the users `PATH`.

    Warning, don't use this to find IPython command line programs as there
    is a risk you will find the wrong one.  Instead find those using the
    following code and looking for the application itself::

        import sys
        argv = [sys.executable, '-m', 'IPython']

    Parameters
    ----------
    cmd : str
        The command line program to look for.
    Nzcommand could not be found: %s)shutilwhichr   )cmdpaths     r   find_cmdr      s1    & <D|;cABBBKr   c                     t          j                                        dd          } d}| }t          j        dk    r7t          |           dk     r| S t           j                            |           \  }}|                    d          }t          |          dk    rd	                    |dd                   }|| dk    rdp|z   S )	z1 Return abbreviated version of cwd, e.g. d:mydir \/ r         N)
osgetcwdreplacesysplatformlenr   
splitdrivesplitjoin)cwd	driveparttailpartss       r   
abbrev_cwdr/   5   s    
)++

d3
'
'CID
|ws88a<<J++C00	$ JJsOOE
5zzA~~xxbcc
##s
s"d$ %r   )__doc__r"   r   r%   r&   _process_win32r   r   r   r   _process_cli_process_posix_process_commonr
   r   r   	Exceptionr   r   r/   r   r   r   <module>r6      s(    
			  



<7GGGGGGGGGGGGG\UEEEEEEEEEEEEEGGGGGGGGGGGG S S S S S S S S S S	 	 	 	 	9 	 	 	  2% % % % %r   