This code never prints "hello". Not sure why?
proc = subprocess.Popen(
'./lite-client -C ton-lite-client-test1.config.json -D ./ton-db-dir',
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True)
line = proc.stderr.readline()
while line != "":
print(line)
print(len(line))
line = proc.stderr.readline()
print("hello")
Once it prints everything from stderr
it's still not printing "hello". stderr
is finite, it prints about 20 lines on startup.
Any thoughts?
Update: stderr
comes from long running process. I want to interact with this process, send commands and read output.
Update 2: I made workaround that works, I added break
if string contains specific substring.