HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.6/site-packages/pexpect/__pycache__/utils.cpython-36.pyc
3

��Zd��@s�ddlZddlZddlZddlZddlZddlZyeWnek
rRejZYnXej	ddkrje
fZnee
fZdd�Z
d
dd�Zdd�Zdd	d
�Zddd�ZdS)�N�cCshtjj|�}tjj|�sdStj|�j}tjjd�rZtj	�dkrZt
|tjtjBtj
B@�Stj|tj�S)z�Checks that path is an executable regular file, or a symlink towards one.

    This is roughly ``os.path isfile(path) and os.access(path, os.X_OK)``.
    F�sunosr)�os�path�realpath�isfile�stat�st_mode�sys�platform�
startswith�getuid�bool�S_IXUSR�S_IXGRP�S_IXOTH�access�X_OK)rZfpath�mode�r�0/tmp/pip-build-hc5bmb4z/pexpect/pexpect/utils.py�is_executable_files
rcCsvtjj|�dkrt|�r|S|dkr*tj}|jd�}|s>tj}|jtj�}x&|D]}tjj	||�}t|�rP|SqPWdS)z�This takes a given filename; tries to find it in the environment path;
    then checks if it is executable. This returns the full path to the filename
    if found and executable. Otherwise this returns None.�N�PATH)
rr�dirnamer�environ�get�defpath�split�pathsep�join)�filename�env�p�pathlistr�ffrrr�which0s

r&c
Csg}d}d}d}d}d}d}|}x�|D]�}	||ks:||kr�|	dkrH|}q�|	dkrV|}q�|	d	krd|}q�|	j�r�||krvq�|j|�d}|}q�||	}|}q&||kr�||	}|}q&||kr�|	dkr�|}q�||	}q&||kr&|	d	kr�|}q&||	}q&W|dk�r|j|�|S)
aThis splits a command line into a list of arguments. It splits arguments
    on spaces, but handles embedded quotes, doublequotes, and escaped
    characters. It's impossible to do this with a regular expression, so I
    wrote a little state machine to parse the command line. rr��r��\�'�")�isspace�append)
Zcommand_line�arg_list�argZstate_basicZ	state_escZstate_singlequoteZstate_doublequoteZstate_whitespace�state�crrr�split_command_lineEsL




r3cCs�|dk	rtj�|}xpytj||||�Stk
r�tj�d}|jdtjkrz|dk	r||tj�}|dkr|gggfSn�YqXqWdS)z�This is a wrapper around select.select() that ignores signals. If
    select.select raises a select.error exception and errno is an EINTR
    error then it is ignored. Mainly this is used to ignore sigwinch
    (terminal resize). Nr'r)�time�select�InterruptedErrorr
�exc_info�args�errno�EINTR)ZiwtdZowtdZewtd�timeout�end_time�errrrr�select_ignore_interrupts�s	r>cCs�|dk	rtj�|}tj�}x,|D]$}|j|tjtjBtjBtjB�q"Wx�y,|dkrZdn|d}|j|�}dd�|D�Stk
r�t	j
�d}|jdtj
kr�|dk	r�|tj�}|dkr�gSn�YqLXqLWdS)zOSimple wrapper around poll to register file descriptors and
    ignore signals.Ni�cSsg|]\}}|�qSrr)�.0Zafd�_rrr�
<listcomp>�sz*poll_ignore_interrupts.<locals>.<listcomp>r'r)r4r5�poll�register�POLLIN�POLLPRI�POLLHUP�POLLERRr6r
r7r8r9r:)Zfdsr;r<Zpoller�fdZ
timeout_ms�resultsr=rrr�poll_ignore_interrupts�s$
$
rJ)N)N)N)rr
rr5r4r9r6�	NameError�error�version_info�str�string_types�unicoderr&r3r>rJrrrr�<module>s"
=