脚本在读取stdout时卡住,不再继续执行,也不发生终止
import subprocess
p = subprocess.Popen(["mplayer", "-slave", "-quiet", "/home/pi/Music/爱的翅膀.mp3"], stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = False)
p.stdin.write('\n')
print p.stdout.read() //此处
p.stdin.write('get_time_pos\n')
print p.stdout.read()
When mplayer plays, a large number of characters will be input to stout. If the number exceeds 4096, it will cause a deadlock. The output information is not what I want, so I decided to modify it
stdout=open("/dev/null","w")
to solve the problem. Reference blog http://blog.csdn.net/imzoer/a...