ianfab / fishtest

distributed chess variant engine testing
http://variantfishtest.org
5 stars 0 forks source link

Use the string literal '' as iter() sentinel #22

Closed ppigazzini closed 3 years ago

ppigazzini commented 3 years ago

File objects for stdin, stdout and stderr by default are opened in bynary mode and require a byte string literal b'' as iter() sentinel.

We have opened the file objects for stdout and stderr in text mode using the "universal_newlines=True" argument in subprocess.Popen() so the correct iter() sentinel is the string literal ''. Using b'' as sentinel is wrong and floods the queue with void lines.

Also move in kill_process() the closing of the stdout pipe.

Porting of a couple of my commits from official fishtest.

ppigazzini commented 3 years ago

@ianfab this fix a bug that keeps the worker busy in processing void lines (the queue is never Empty).

https://github.com/ianfab/fishtest/blob/fe49c9ea82e7ee949948c55de84ad1f7610df349/worker/games.py#L211-L225

My workers are running with #21 and #22