0
点赞
收藏
分享

微信扫一扫

python:cmd管道

IT影子 2022-08-27 阅读 63

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写的时候第一行 一定要有 否则按照空行 会报错

-----------------------------------------------------------------------------------------------------------------------------------------



举报

相关推荐

0 条评论