Skip to content

start-process-with-no-shell (S606)#

Derived from the flake8-bandit linter.

What it does#

Checks for functions that start a process without a shell.

Why is this bad?#

The subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using these functions.


os.spawnlp(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg")

Use instead:

subprocess.Popen(["/bin/mycmd", "myarg"])