Viewing File: /opt/imunify360/venv/lib/python3.11/site-packages/clcommon/__pycache__/utils_cmd.cpython-311.pyc



]j
NddlZddlZddlZGddeZdZd	dZdZdS)
Nc eZdZdZddefdZdS)ExternalProgramFailedzCException class for errors related to externally executed commands.messagec<t||dS)N)	Exception__init__)selfrs  r/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/clcommon/utils_cmd.pyr	zExternalProgramFailed.__init__s4)))))N)r)__name__
__module____qualname____doc__strr	rrrrs:MM********rrctj|s)td|dt	jddSdS)z6
    Checks if command is present and exits if no
    zCommand not found: ()N)ospathexistsprintsysexit)cmdnames r
check_commandrsO7>>'""
/W///000rFTc	`d|}	|rtjntj}|rtjntj}tj||tj|d||5}|s|\}	}
n||\}	}
|j}dddn#1swxYwYn4#t$r'}t|dt||d}~wwxYw|r||	|
fS|dkr+|std|t|
pd|d	|	|	S)
a[
    Runs external process and returns output
    :param cmd: command and arguments as a list
    :param env_data: environment data for process
    :param return_full_output: if true, returns (ret_code, std_out, std_err)
    @return: process stdout if is_full_output==False
    else - cortege (ret_code, std_out, std_err) without any checking
     T)stdinstdoutstderr	close_fdsenvtextNz. Cannot run command: rz Error during command execution: zoutput of the command: 
)join
subprocessPIPESTDOUTDEVNULLPopencommunicate
returncodeOSErrorrr)
cmdenv_datareturn_full_outputstd_inconvert_to_strcmd_linestd_err_obj	stdin_argprocstd_outstd_errr.oserrs
             rrun_commandr<sxx}}H);RjooAR'-EJOO:3E	

?



	)
<#'#3#3#5#5 #'#3#3F#;#; J
	)
	)
	)
	)
	)
	)
	)
	)
	)
	)
	)
	)
	)
	)
	)#;;s5zz;;

	
,7G++Q	'(U8(U(UVVV'JJXJJJJ
Ns<AC0:B6*C6B::C=B:>C
C3"C..C3c4g}||||tj|tjd5}|\}}|j}dddn#1swxYwY||fS)z
    Executes supplied utility with supplied parameters
    :param util_path: Executable file to run path
    :param params: utility parameters
    :return: Cortege (ret_code, utility_stdout)
    T)r!r%N)appendextendr(r,r)r-r.strip)	util_pathparamsargsr8r!_retcodes       rexec_utilityrFGsDKK	KK		$zT	B	B	B"d$$&&	/"""""""""""""""FLLNN""sA99A=A=)NFNT)rrr(rrrr<rFrrr<module>rGs
			



*****I***))))X
#
#
#
#
#r
Back to Directory File Manager