Is there a limitation for command.getstatusoutput () command buffer in python

I created a script to run a script test in a package of files, tested it overnight for two nights, however it just freezes at some point.

I was wondering if the command.getstatusoutput () problem is here, since the test script has a heavy logging mechanism.

Update:
How is using subprocess module functions different from using os.system (), what is the best way to do things?

+3
source share
1 answer

getstatusoutput() , , , .

commands , , subprocess, . ,

cmd = subprocess.Popen(['ls'], stdout=file('output', 'w'))

, , stdout,

cmd = subprocess.Popen(['ls'], stdout=subprocess.PIPE)
for line in cmd.stdout:
    do_stuff(line)

.

+6

Source: https://habr.com/ru/post/1734078/


All Articles