Skip to content

deprecate and replace snakeoil.process.spawn #119

Description

@ferringb

The api of that predates subprocess (literally, py2.2 or py2.3); there are things I did in there that subprocess still lacks (the FD juggling for pipes for example) that will require extending the subprocess.Popen api, but the spawn API , now, is extremely high friction. The only things that use it are snakeoil and pkgcore.

Things it needs:

  • remapping of FDs from host to specific FD's within the child
  • ability to change UID/GID. A way to relay the failure to do so back to the parent in a clean manner for throwing a seperate exception- or detecting that it'll fail up front (ambient capabilities)- should be integrated
  • The split_lines thing is layer violation; remove it. If it's in heavy use, come up w/ a solution that wraps rather than embeds it into the core logic.
  • spawn_type roughly was a way to do an injection of desired execution; IE, whatever the command you're told to run, I want you to sandbox it, thus wrap it in this. That dep injection pattern may be worth preserving, but if so, it must have a typing.Protocol. I suspect desiging an overridable class can address this.

Things to consider before implementing this:

  • Should this just be moved fully into pkgcore? Snakeoil has uses of it, but that's for ArComp which needs to be rewritten to modern standards. I don't think anything remains that would use the process.spawn api's in snakeoil, and nothing outside of pkgcore uses it.
  • IE, if that's true, either write somethign anew in pkgcore, or bulk lift it all into pkgcore and deal w/ that refactoring as an internal (non semver visible) thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    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