Skip to content

pyfakefs breaks subprocesses #447

@majuscule

Description

@majuscule

pyfakefs breaks stdlib subprocess calls as shown below. Running on Ubuntu 16.04.5 LTS.

import subprocess

def test_fake_fs(fs):
    assert subprocess.run(['echo'])
self = <pyfakefs.fake_filesystem.FakeFilesystem object at 0x7fcbfda2acc0>, errno = 9, filename = '9', winerror = None

    def raise_os_error(self, errno, filename=None, winerror=None):
        """Raises OSError.
        The error message is constructed from the given error code and shall
        start with the error string issued in the real system.
        Note: this is not true under Windows if winerror is given - in this
        case a localized message specific to winerror will be shown in the
        real file system.
    
        Args:
            errno: A numeric error code from the C variable errno.
            filename: The name of the affected file, if any.
            winerror: Windows only - the specific Windows error code.
        """
        message = self._error_message(errno)
        if (winerror is not None and sys.platform == 'win32' and
                self.is_windows_fs):
            if IS_PY2:
                raise WindowsError(winerror, message, filename)
            raise OSError(errno, message, filename, winerror)
>       raise OSError(errno, message, filename)
E       OSError: [Errno 9] Bad file descriptor in the fake filesystem: '9'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions