This commit is contained in:
thsrite
2024-04-02 12:59:31 +08:00
parent cf30b8055e
commit 4c3b2b516e

View File

@@ -112,13 +112,6 @@ class CustomCommand(_PluginBase):
last_output = None
last_error = None
while True:
output = result.stdout.readline().decode("utf-8")
if output == '' and result.poll() is not None:
break
if output:
logger.info(output.strip())
last_output = output.strip()
error = result.stderr.readline().decode("utf-8")
if error == '' and result.poll() is not None:
break
@@ -126,6 +119,13 @@ class CustomCommand(_PluginBase):
logger.info(error.strip())
last_error = error.strip()
output = result.stdout.readline().decode("utf-8")
if output == '' and result.poll() is not None:
break
if output:
logger.info(output.strip())
last_output = output.strip()
logger.info(
f"执行命令:{command} {'成功' if result.returncode == 0 else '失败'} 返回值:{last_output if last_output else last_error}")