update
This commit is contained in:
@@ -22,9 +22,10 @@ class SupportSubprocess(object):
|
||||
# 2021-10-25
|
||||
# timeout 적용
|
||||
@classmethod
|
||||
def execute_command_return(cls, command, format=None, force_log=False, shell=False, env=None, timeout=None, uid=0, gid=0):
|
||||
def execute_command_return(cls, command, format=None, log=False, shell=False, env=None, timeout=None, uid=0, gid=0):
|
||||
|
||||
try:
|
||||
logger.debug(f"execute_command_return : {' '.join(command)}")
|
||||
if platform.system() == 'Windows':
|
||||
tmp = []
|
||||
if type(command) == type([]):
|
||||
@@ -39,7 +40,8 @@ class SupportSubprocess(object):
|
||||
if platform.system() == 'Windows':
|
||||
process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, shell=shell, env=env, encoding='utf8')
|
||||
else:
|
||||
process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, shell=shell, env=env, preexec_fn=demote(uid, gid), encoding='utf8')
|
||||
#process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, shell=shell, env=env, preexec_fn=demote(uid, gid), encoding='utf8')
|
||||
process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, shell=shell, env=env, encoding='utf8')
|
||||
|
||||
|
||||
new_ret = {'status':'finish', 'log':None}
|
||||
@@ -57,7 +59,7 @@ class SupportSubprocess(object):
|
||||
with process.stdout:
|
||||
for line in iter(process.stdout.readline, iter_arg):
|
||||
ret.append(line.strip())
|
||||
if force_log:
|
||||
if log:
|
||||
logger.debug(ret[-1])
|
||||
|
||||
if format is None:
|
||||
|
||||
Reference in New Issue
Block a user