diff --git a/invoke/runners.py b/invoke/runners.py index 423cb797..138a3696 100644 --- a/invoke/runners.py +++ b/invoke/runners.py @@ -1385,6 +1385,11 @@ def returncode(self) -> Optional[int]: return self.process.returncode def stop(self) -> None: + for fd in ['stdout', 'stderr', 'stdin']: + try: + getattr(self.process, fd).close() + except: + pass # We tried 🤷 # If we opened a PTY for child communications, make sure to close() it, # otherwise long-running Invoke-using processes exhaust their file # descriptors eventually.