Skip to content

Commit

Permalink
fix(python): ValueError: write to closed file (#2541)
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainMuller authored Feb 5, 2021
2 parents 6513f9c + f24e80a commit 64c6853
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,10 @@ def stop(self):
# This process is closing already, un-registering the hook to not fire twice
atexit.unregister(self.stop)

self._process.stdin.write(b'{"exit":0}\n')
# Close the process' STDIN, singaling we are done with it
self._process.stdin.close()
if not self._process.stdin.closed:
self._process.stdin.write(b'{"exit":0}\n')
# Close the process' STDIN, singaling we are done with it
self._process.stdin.close()

try:
self._process.wait(timeout=5)
Expand Down

0 comments on commit 64c6853

Please sign in to comment.