Make demo_logging pause while writing stdout
This commit is contained in:
parent
e432cac969
commit
096a594813
|
@ -5,10 +5,17 @@ import os
|
|||
import sys
|
||||
import time
|
||||
|
||||
for i in range(3):
|
||||
greeting = os.environ.get("HELLO", "MISSING")
|
||||
item = json.dumps({
|
||||
"id": "helloworld",
|
||||
"title": "Hello = " + greeting
|
||||
})
|
||||
sys.stdout.write(item[:10])
|
||||
sys.stdout.flush()
|
||||
|
||||
for i in range(5):
|
||||
sys.stderr.write(f"{i+1}...\n")
|
||||
sys.stderr.flush()
|
||||
time.sleep(1)
|
||||
|
||||
item = json.dumps({"id": "helloworld", "title": "Hello = " + os.environ.get("HELLO", "MISSING")})
|
||||
print(item)
|
||||
sys.stdout.write(item[10:])
|
||||
|
|
Loading…
Reference in New Issue