Skip to content

Commit 99593db

Browse files
committed
fix an error in cookbook
1 parent ee4933f commit 99593db

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/cookbook.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,12 @@ The following code shows how to redirect stdout of python code and subprocess to
211211
process = subprocess.Popen("ls -ahl", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
212212
while True:
213213
output = process.stdout.readline()
214-
if output == '' and process.poll() is not None:
215-
break
216214
if output:
217215
put_text(output.decode('utf8'), inline=True)
218216

217+
if not output and process.poll() is not None:
218+
break
219+
219220

220221
Add missing syntax highlight for code output
221222
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)