mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 14:21:53 +00:00
20 lines
568 B
Python
20 lines
568 B
Python
from subprocess import Popen, call, check_call, check_output, run
|
|
|
|
# Check different Popen wrappers are checked.
|
|
Popen("true", shell=True)
|
|
call("true", shell=True)
|
|
check_call("true", shell=True)
|
|
check_output("true", shell=True)
|
|
run("true", shell=True)
|
|
|
|
# Check values that truthy values are treated as true.
|
|
Popen("true", shell=1)
|
|
Popen("true", shell=[1])
|
|
Popen("true", shell={1: 1})
|
|
Popen("true", shell=(1,))
|
|
|
|
# Check command argument looks unsafe.
|
|
var_string = "true"
|
|
Popen(var_string, shell=True)
|
|
Popen([var_string], shell=True)
|
|
Popen([var_string, ""], shell=True)
|