403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.52
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/IPython/utils/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/IPython/utils/tests/__pycache__/test_process.cpython-312.pyc
�

}�e��
�Z�dZddlZddlZddlZddlZddlmZddlZddlZddl	m
Z
mZmZm
Z
mZmZmZddlmZddlmZddlmZej0j3ej4�Zej8d��Zej<d	��Zd
�Z ej8ejBjEdddgfd
ddgfddgfdddgfg�d���Z#ej<ejBjEdddgfd
ddgfddgfdddgfg�d���Z$Gd�dejJ�Z&y)z
Tests for platutils.py
�N)�interrupt_main)�find_cmd�FindCmdError�	arg_split�system�	getoutput�getoutputerror�get_output_error_code)�capture_output)�
decorators)�toolsc�@�td�}|jd�sJ�y)z*Make sure we can find the full path to ls.�lsN)r�endswith��paths �B/usr/lib/python3/dist-packages/IPython/utils/tests/test_process.py�test_find_cmd_lsr's���D�>�D��=�=�����c�f�td�}|j�jd�sJ|��y)zTry to find pythonw on Windows.�pythonwzpythonw.exeN)r�lowerrrs r�test_find_cmd_pythonwr.s-���I��D��:�:�<� � ��/�5��5�/rc�B�tjttd�y)z?Make sure that FindCmdError is raised if we can't find the cmd.�asdfasdfN)�pytest�raisesrr�rr�test_find_cmd_failr5s��
�M�M�,��*�5rzargstr, argv�hizhello there�hello�thereuhǎllozsomething "with quotes"�	somethingz
"with quotes"c�$�t|�|k(sJ�y�z?Ensure that argument lines are correctly split like in a shell.N�r��argstr�argvs  r�test_arg_splitr*:s���V���$�$�$rzargstr,argvzwith quotesc�$�t|�|k(sJ�yr%r&r's  r�test_arg_split_win32r,Ls���V���$�$�$rc�f�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	e
jd��Zd	�Z
d
�Zy)�SubProcessTestCasec�L�gd�}|jdj|��y)zMake a valid python temp file.)z
import sysz+print('on stdout', end='', file=sys.stdout)z+print('on stderr', end='', file=sys.stderr)zsys.stdout.flush()zsys.stderr.flush()�
N)�mktmp�join)�self�liness  r�setUpzSubProcessTestCase.setUp\s ��'��
	
�
�
�4�9�9�U�#�$rc�f�tt�d|j�d��}|j|d�y)N� "�"r)r�python�fname�assertEqual�r3�statuss  r�test_systemzSubProcessTestCase.test_systemes-���6�(�"�T�Z�Z�L��2�3�������#rc�L�tdtz�}|j|d�y)Nz%s -c "import sys"r)rr9r;r<s  r�test_system_quotesz%SubProcessTestCase.test_system_quotesis"���,�v�5�6�������#rc���tj�tj�k7rtjd��tj
t
jt
j�d�}tj|��j�tj�}	|�}tj�}|j||z
dkd||z
z�S#t$rY�?wxYw)z8
        Interrupt a subprocess after a second.
        z*Can't run this test if not in main thread.c�B�tjd�t�y)Ng�?)�time�sleeprrrr�	interruptz7SubProcessTestCase.assert_interrupts.<locals>.interruptys���J�J�s�O��r)�target�zProcess didn't die quickly: %s)
�	threading�main_thread�current_threadr�skip�signal�SIGINT�default_int_handler�Thread�startrC�KeyboardInterrupt�
assertTrue)r3�commandrErP�result�ends      r�assert_interruptsz$SubProcessTestCase.assert_interruptsms���� � �"�i�&>�&>�&@�@��+�+�J�K�K�
	�
�
�f�m�m�V�%?�%?�@�	�
	���	�*�0�0�2��	�	���	��Y�F��i�i�k������%�K�!�O�=��u��M�	
��
��!�	��	�s�-C(�(	C4�3C4c�X�d�}|j|�}|j|dd|���y)zr
        When interrupted in the way ipykernel interrupts IPython, the
        subprocess is interrupted.
        c�&�tdtz�S)Nz"%s -c "import time; time.sleep(5)")rr9rrrrSz9SubProcessTestCase.test_system_interrupt.<locals>.command�s���>��G�H�Hrrz(The process wasn't interrupted. Status: N)rV�assertNotEqual)r3rSr=s   r�test_system_interruptz(SubProcessTestCase.test_system_interrupt�s7��
	I��'�'��0������A�A�&��J�	
rc��tt�d|j�d��}	|j|d�y#t$r|j|d�YywxYw)Nr7r8zon stderron stdoutzon stdouton stderr)rr9r:r;�AssertionError�r3�outs  r�test_getoutputz!SubProcessTestCase.test_getoutput�sS���6�(�"�T�Z�Z�L��2�3��	8����S�"6�7���	8����S�"6�7�	8�s�4�A�Ac�h�tdtz�}|j|j�d�y)Nz%s -c "print (1)"�1�rr9r;�stripr]s  r�test_getoutput_quotedz(SubProcessTestCase.test_getoutput_quoted�s(���+�f�4�5���������c�*rc���tdtz�}|j|j�d�tdtz�}|j|j�d�y)Nz%s -c 'print (1)'raz%s -c 'print ("1")'rbr]s  r�test_getoutput_quoted2z)SubProcessTestCase.test_getoutput_quoted2�sN���+�f�4�5���������c�*��/�&�8�9���������c�*rc��tt�d|j�d��\}}|j|d�|j|d�y)Nr7r8�	on stdout�	on stderr)r	r9r:r;)r3r^�errs   r�test_getoutput_errorz'SubProcessTestCase.test_getoutput_error�sA��!�V�H�B�t�z�z�l�!�"<�=���S�����k�*�����k�*rc�R�dtz}t|�\}}}|j|d�|j|d�|j|d�tt�d|j�d��\}}}|j|d�|j|d�|j|d�y)	Nz%s -c "import sys; sys.exit(1)"��r7r8rhrir)r9r
r;r:)r3�
quiet_exitr^rj�codes     r�test_get_output_error_codez-SubProcessTestCase.test_get_output_error_code�s���6��?�
�.�z�:���S�$�����b�!�����b�!�����q�!�.�&���D�J�J�<�q�/I�J���S�$�����k�*�����k�*�����q�!rN)�__name__�
__module__�__qualname__r5r>r@rVrZr_rd�dec�
skip_win32rfrkrqrrrr.r.[sG��%�$�$��<
�8�+�
	�^�^�+��+�+�
	"rr.)'�__doc__�sysrL�osrC�_threadrrHr�IPython.utils.processrrrrrr	r
�IPython.utils.capturer�IPython.testingrrur
�ttr�basename�
executabler9rvr�skip_if_not_win32rr�mark�parametrizer*r,�
TempFileMixinr.rrr�<module>r�sj����
�	��"��
�:�:�:�1�-�'�	���	�	�#�.�.�	)�����������6��6�6�
���������	
��v��	��'�*�+�
��~�&�	"�[�/�$B�C���%���%�
���������	
��v��	��'�*�+�	��~�&�	"�[�-�$@�A�	��%���%�
_"��)�)�_"r

Youez - 2016 - github.com/yon3zu
LinuXploit