Is there a way to print stdout as it is outputted?

498 Views Asked by At

If if I ran

from plumbum import local
local['ping']['google.com']()

It would just hang indefinitely because ping executes forever.

Is there a way to print the output of ping as it executes, perhaps in a generator or something, like

for a in local['ping']['google.com']():
    print a
1

There are 1 best solutions below

2
On

According to the documentation, this should work:

from plumbum import local, FG

local["ping"]["google.com"] & FG