Python posix.dup2() Examples

The following are 15 code examples of posix.dup2(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module posix , or try the search function .
Example #1
Source File: posixfile.py    From meddle with MIT License 5 votes vote down vote up
def dup2(self, fd):
        import posix

        if not hasattr(posix, 'fdopen'):
            raise AttributeError, 'dup() method unavailable'

        posix.dup2(self._file_.fileno(), fd)
        return posix.fdopen(fd, self._file_.mode) 
Example #2
Source File: posixfile.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def dup2(self, fd):
        import posix

        if not hasattr(posix, 'fdopen'):
            raise AttributeError, 'dup() method unavailable'

        posix.dup2(self._file_.fileno(), fd)
        return posix.fdopen(fd, self._file_.mode) 
Example #3
Source File: posixfile.py    From BinderFilter with MIT License 5 votes vote down vote up
def dup2(self, fd):
        import posix

        if not hasattr(posix, 'fdopen'):
            raise AttributeError, 'dup() method unavailable'

        posix.dup2(self._file_.fileno(), fd)
        return posix.fdopen(fd, self._file_.mode) 
Example #4
Source File: posixfile.py    From oss-ftp with MIT License 5 votes vote down vote up
def dup2(self, fd):
        import posix

        if not hasattr(posix, 'fdopen'):
            raise AttributeError, 'dup() method unavailable'

        posix.dup2(self._file_.fileno(), fd)
        return posix.fdopen(fd, self._file_.mode) 
Example #5
Source File: posixfile.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def dup2(self, fd):
        import posix

        if not hasattr(posix, 'fdopen'):
            raise AttributeError, 'dup() method unavailable'

        posix.dup2(self._file_.fileno(), fd)
        return posix.fdopen(fd, self._file_.mode) 
Example #6
Source File: posixfile.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def dup2(self, fd):
        import posix

        if not hasattr(posix, 'fdopen'):
            raise AttributeError, 'dup() method unavailable'

        posix.dup2(self._file_.fileno(), fd)
        return posix.fdopen(fd, self._file_.mode) 
Example #7
Source File: test_posix.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_dup2(self):
        if hasattr(posix, 'dup2'):
            fp1 = open(test_support.TESTFN)
            fp2 = open(test_support.TESTFN)
            try:
                posix.dup2(fp1.fileno(), fp2.fileno())
            finally:
                fp1.close()
                fp2.close() 
Example #8
Source File: posixfile.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def dup2(self, fd):
        import posix

        if not hasattr(posix, 'fdopen'):
            raise AttributeError, 'dup() method unavailable'

        posix.dup2(self._file_.fileno(), fd)
        return posix.fdopen(fd, self._file_.mode) 
Example #9
Source File: posixfile.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def dup2(self, fd):
        import posix

        if not hasattr(posix, 'fdopen'):
            raise AttributeError, 'dup() method unavailable'

        posix.dup2(self._file_.fileno(), fd)
        return posix.fdopen(fd, self._file_.mode) 
Example #10
Source File: posixfile.py    From RevitBatchProcessor with GNU General Public License v3.0 5 votes vote down vote up
def dup2(self, fd):
        import posix

        if not hasattr(posix, 'fdopen'):
            raise AttributeError, 'dup() method unavailable'

        posix.dup2(self._file_.fileno(), fd)
        return posix.fdopen(fd, self._file_.mode) 
Example #11
Source File: posixfile.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def dup2(self, fd):
        import posix

        if not hasattr(posix, 'fdopen'):
            raise AttributeError, 'dup() method unavailable'

        posix.dup2(self._file_.fileno(), fd)
        return posix.fdopen(fd, self._file_.mode) 
Example #12
Source File: posixfile.py    From unity-python with MIT License 5 votes vote down vote up
def dup2(self, fd):
        import posix

        if not hasattr(posix, 'fdopen'):
            raise AttributeError, 'dup() method unavailable'

        posix.dup2(self._file_.fileno(), fd)
        return posix.fdopen(fd, self._file_.mode) 
Example #13
Source File: posixfile.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
def dup2(self, fd):
        import posix

        if not hasattr(posix, 'fdopen'):
            raise AttributeError, 'dup() method unavailable'

        posix.dup2(self._file_.fileno(), fd)
        return posix.fdopen(fd, self._file_.mode) 
Example #14
Source File: posixfile.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def dup2(self, fd):
        import posix

        if not hasattr(posix, 'fdopen'):
            raise AttributeError, 'dup() method unavailable'

        posix.dup2(self._file_.fileno(), fd)
        return posix.fdopen(fd, self._file_.mode) 
Example #15
Source File: posixfile.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def dup2(self, fd):
        import posix

        if not hasattr(posix, 'fdopen'):
            raise AttributeError, 'dup() method unavailable'

        posix.dup2(self._file_.fileno(), fd)
        return posix.fdopen(fd, self._file_.mode)