Skip to content

Commit 0cea56f

Browse files
committed
(Try to) close suprocess file handles after we are done with it
This should fix pyinvoke#665
1 parent e956312 commit 0cea56f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

invoke/runners.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,11 @@ def returncode(self) -> Optional[int]:
13851385
return self.process.returncode
13861386

13871387
def stop(self) -> None:
1388+
for fd in ['stdout', 'stderr', 'stdin']:
1389+
try:
1390+
getattr(self.process, fd).close()
1391+
except:
1392+
pass # We tried 🤷
13881393
# If we opened a PTY for child communications, make sure to close() it,
13891394
# otherwise long-running Invoke-using processes exhaust their file
13901395
# descriptors eventually.

0 commit comments

Comments
 (0)