Skip to content

Add subprocess.shell(cmd) function: similar to os.system(), but use subprocess #120952

@vstinner

Description

@vstinner

Feature or enhancement

Hi,

I propose to add a subprocess.shell(cmd) function similar to os.system(), but use subprocess: close file descriptors, restore signal handlers, etc. The function runs a shell command and so is vulnerable by design to shell injection vulnerability if an attacker can modify the shell command.

The function accepts keyword arguments: subprocess.shell(cmd, env=env), subprocess.shell(cmd, stdout=subprocess.PIPE), etc.

This proposition is related to os.system() soft deprecation: #120744

What do you think?

Victor

cc @gpshead @zooba

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions