Skip to content

The preexec_fn should be executed before closing the file descriptors.  #55

@eldipa

Description

@eldipa

Currently, the preexec_fn is executed after the file descriptors are closed. This has some unwanted effects:

The proposal is to move the "close the fds" section below the "execute the preexec_fn" code: https://github.com/pexpect/ptyprocess/blob/master/ptyprocess/ptyprocess.py#L266-L285

For reference, this is what it does subprocess.Popen: https://github.com/python/cpython/blob/master/Modules/_posixsubprocess.c#L528-L549

If it is okay, I can do a PR with the fix but I would like to hear your opinions about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions