SpawnProcess: handle fcntl ENOTTY for FreeBSD
authorZac Medico <zmedico@gentoo.org>
Thu, 10 Jan 2013 11:11:35 +0000 (03:11 -0800)
committerZac Medico <zmedico@gentoo.org>
Thu, 10 Jan 2013 11:11:35 +0000 (03:11 -0800)
pym/_emerge/SpawnProcess.py

index f226dcb8f03c444b292841dfd2abb0cd05b1effd..5d0fcf6dd6feb2735ed7ab6860945fa462c8acfe 100644 (file)
@@ -117,9 +117,14 @@ class SpawnProcess(SubProcess):
                                except AttributeError:
                                        pass
                                else:
-                                       fcntl.fcntl(stdout_fd, fcntl.F_SETFL,
-                                               fcntl.fcntl(stdout_fd,
-                                               fcntl.F_GETFL) | fcntl.FD_CLOEXEC)
+                                       try:
+                                               fcntl.fcntl(stdout_fd, fcntl.F_SETFL,
+                                                       fcntl.fcntl(stdout_fd,
+                                                       fcntl.F_GETFL) | fcntl.FD_CLOEXEC)
+                                       except IOError:
+                                               # FreeBSD may return "Inappropriate ioctl for device"
+                                               # error here (ENOTTY).
+                                               pass
 
                self._pipe_logger = PipeLogger(background=self.background,
                        scheduler=self.scheduler, input_fd=master_fd,