python:cmd管道
作者:互联网
commands = f"""ssh root@120.7x.254.99 -p2483 cd /data/wwwroot/csjs2_client_dev git pull ssh://git@172.16.x.161x:2483/data/repos/csjs2_client_dev.git """ import subprocess def subprocess_popen(commands,stdout=subprocess.PIPE, stderr=subprocess.STDOUT): current_process = subprocess.Popen(commands, stdout=stdout, stderr=stderr) standoutput, standerr = current_process.communicate() current_process.wait() current_process.kill() print(standoutput) return standoutput subprocess_popen(commands)
备注:commands写的时候第一行 一定要有 否则按照空行 会报错
标签:commands,standoutput,stdout,python,cmd,subprocess,current,process,管道 来源: https://www.cnblogs.com/wusen0601/p/16619356.html