import subprocess def exec_command(cmd, log_path, **kwargs): with open(log_path, 'w') as f: p = subprocess.Popen(cmd, shell=True, stdout=f.fileno(), stderr=f.fileno(), executable='/bin/bash', **kwargs) p.communicate() #立即阻塞父进程,直到子进程结束 if p.returncode…