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 sys
|
||||||
import time
|
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.write(f"{i+1}...\n")
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
item = json.dumps({"id": "helloworld", "title": "Hello = " + os.environ.get("HELLO", "MISSING")})
|
sys.stdout.write(item[10:])
|
||||||
print(item)
|
|
||||||
|
|
Loading…
Reference in New Issue