diff options
Diffstat (limited to 'pym/portage/util/_async/PipeLogger.py')
-rw-r--r-- | pym/portage/util/_async/PipeLogger.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/pym/portage/util/_async/PipeLogger.py b/pym/portage/util/_async/PipeLogger.py index 5464879ff..d0b132378 100644 --- a/pym/portage/util/_async/PipeLogger.py +++ b/pym/portage/util/_async/PipeLogger.py @@ -46,10 +46,15 @@ class PipeLogger(AbstractPollTask): else: fcntl_flags |= fcntl.FD_CLOEXEC - fcntl.fcntl(self.input_fd, fcntl.F_SETFL, - fcntl.fcntl(self.input_fd, fcntl.F_GETFL) | fcntl_flags) + if isinstance(self.input_fd, int): + fd = self.input_fd + else: + fd = self.input_fd.fileno() + + fcntl.fcntl(fd, fcntl.F_SETFL, + fcntl.fcntl(fd, fcntl.F_GETFL) | fcntl_flags) - self._reg_id = self.scheduler.io_add_watch(self.input_fd, + self._reg_id = self.scheduler.io_add_watch(fd, self._registered_events, self._output_handler) self._registered = True @@ -133,7 +138,10 @@ class PipeLogger(AbstractPollTask): self._reg_id = None if self.input_fd is not None: - os.close(self.input_fd) + if isinstance(self.input_fd, int): + os.close(self.input_fd) + else: + self.input_fd.close() self.input_fd = None if self.stdout_fd is not None: |