o
    œ©ZhÆ  ã                   @   sØ   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	 n0ejdkr2ddl
mZmZmZm	Z	 nejdkrDd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
„ d
eƒZdd„ Zdd„ ZdS )z0
Utilities for working with external processes.
é    NÚwin32é   )ÚsystemÚ	getoutputÚ	arg_splitÚ	check_pidÚcliZ
emscripten)ÚgetoutputerrorÚget_output_error_codeÚprocess_handlerc                   @   s   e Zd ZdS )ÚFindCmdErrorN)Ú__name__Ú
__module__Ú__qualname__© r   r   úL/var/www/html/lang_env/lib/python3.10/site-packages/IPython/utils/process.pyr      s    r   c                 C   s"   t  | ¡}|du rtd|  ƒ‚|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Úpathr   r   r   Úfind_cmd   s   
r   c                  C   s~   t  ¡  dd¡} d}| }tjdkr!t| ƒdk r| S t j | ¡\}}| d¡}t|ƒdkr5d 	|dd… ¡}|| dkr<dp=| S )	z1 Return abbreviated version of cwd, e.g. d:mydir ú\ú/Ú r   é   é   éþÿÿÿN)
ÚosÚgetcwdÚreplaceÚsysÚplatformÚlenr   Ú
splitdriveÚsplitÚjoin)ÚcwdZ	drivepartÚtailÚpartsr   r   r   Ú
abbrev_cwd7   s   

ÿr)   )Ú__doc__r   r   r    r!   Z_process_win32r   r   r   r   Z_process_cliZ_process_emscriptenZ_process_posixZ_process_commonr	   r
   r   Ú	Exceptionr   r   r)   r   r   r   r   Ú<module>   s   


