subprocess.Popen当 shell=True, shell 默认为 /bin/sh,设置成为以/bin/bash/执行
cmd = "ls -la"
ret = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
executable="/bin/bash")
output = ret.stdout.readlines()
print(output)
subprocess.Popen当 shell=True, shell 默认为 /bin/sh,设置成为以/bin/bash/执行
cmd = "ls -la"
ret = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
executable="/bin/bash")
output = ret.stdout.readlines()
print(output)
本文标题:subprocess.Popen
本文链接:https://www.haomeiwen.com/subject/jrjuzltx.html
网友评论