Streaming shell output from Flask view works, but never ends
iter(proc.stdout.readline, '')
calls readline until it encounters something that equals ''
. But proc.stdout.readline
returns bytes
objects, and ''
is a str
object, so the two will never equal!
Instead, either write
for line in iter(proc.stdout.readline, b''):
or, even better:
for line in proc.stdout: