def run_cmd(cmd):
out = ''
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
while p.poll() is None:
line = p.stdout.readline()
line = line.strip()
if line:
out = str(line, encoding='utf-8')
# if p.returncode == 0:
# print('CMD RUN SUCCESS')
# else:
# print('CMD RUN FAILED')
return out
subprocess
最新推荐文章于 2024-06-14 02:02:23 发布