Using subprocess for socat in Python
I am trying to use the subprocess
to execute a command socat
. It just echos the command as 'show stat | socat unix-connect:/users/viperias/Applications/haproxy.stat stdio'
'show stat | socat unix-connect:/users/viperias/Applications/haproxy.stat stdio'
rather than printing the output of the command. It perfectly works for the other commands. Am I missing something?
def main():
cmd = "echo show stat | socat unix-connect:/users/viperias/Applications/haproxy.stat stdio"
ps = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
output = ps.communicate()[0]
print (output)
main()
链接地址: http://www.djcxy.com/p/77092.html
下一篇: 在Python中使用socat的子进程