ok

Mini Shell

Direktori : /usr/share/lvemanager/__pycache__/
Upload File :
Current File : //usr/share/lvemanager/__pycache__/exec_command.cpython-311.pyc

�

�o`g��P�ddlmZddlmZddlmZddlZddlZd�Zdd�Zdd�ZdS)	�)�print_function)�division)�absolute_importNc��t|t��r.|���dkrgStj|��St|t
��r|SgS)z;
    Parses a command string into a list of arguments.
    �)�
isinstance�str�strip�shlex�split�list)�commands �exec_command.py�
parse_commandrsZ���'�3�����=�=�?�?�b� � ��I��{�7�#�#�#�	�G�T�	"�	"�����	�c��g}	t|��}|std|�����tj|tj|d���}	|j���}|sn@|���dkr'|�|������\n4#t$r'}tdt|����Yd}~nd}~wwxYw|S)z
    Execute command
    �#The provided command is not valid: T��stdout�env�text�rzCall process error:N)r�
ValueError�
subprocess�Popen�PIPEr�readliner
�append�	Exception�printr	)rr�result�args�p�output�insts       r�exec_commandr&s����F�0��W�%�%���	N��L�7�L�L�M�M�M���T�*�/�s��N�N�N��	.��X�&�&�(�(�F��
���|�|�~�~��#�#��
�
�f�l�l�n�n�-�-�-�	.����0�0�0�
�#�S��Y�Y�/�/�/�/�/�/�/�/�����0�����Ms�B"B'�'
C�1C�Cc�V�	t|��}|std|�����tj|tj|d���}|���\}}|jdkrdSdS#t$r/}td|zdzt|��z��Yd}~nd}~wwxYwdS)	z*
    Execute command and check output
    rTrrFzCall process error(z): N)
rrrrr�communicate�
returncoderr r	)rrr"r#�res_in_json�errr%s       r�exec_command_checkr,1s���
C��W�%�%���	N��L�7�L�L�M�M�M���T�*�/�s��N�N�N���]�]�_�_���c�
�L�A����5��t���C�C�C�
�#�g�-��5��D�	�	�A�B�B�B�B�B�B�B�B�����C�����5s�A'A-�-
B&�7%B!�!B&)N)	�
__future__rrrrrrr&r,�rr�<module>r/s���&�%�%�%�%�%�������&�&�&�&�&�&����������������*�����r

Zerion Mini Shell 1.0