diff options
Diffstat (limited to 'Lib/multiprocessing/popen_fork.py')
-rw-r--r-- | Lib/multiprocessing/popen_fork.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/multiprocessing/popen_fork.py b/Lib/multiprocessing/popen_fork.py index ca28bf3..5af9d91 100644 --- a/Lib/multiprocessing/popen_fork.py +++ b/Lib/multiprocessing/popen_fork.py @@ -17,6 +17,7 @@ class Popen(object): sys.stdout.flush() sys.stderr.flush() self.returncode = None + self.finalizer = None self._launch(process_obj) def duplicate_for_child(self, fd): @@ -70,5 +71,9 @@ class Popen(object): os._exit(code) else: os.close(child_w) - util.Finalize(self, os.close, (parent_r,)) + self.finalizer = util.Finalize(self, os.close, (parent_r,)) self.sentinel = parent_r + + def close(self): + if self.finalizer is not None: + self.finalizer() |