mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-12-15 00:25:16 +00:00
9 lines
224 B
Python
9 lines
224 B
Python
import shlex
|
|
import subprocess
|
|
|
|
|
|
def safe_run_cmd(cmd_str, cmd_args=(), shell=True):
|
|
cmd_args = [shlex.quote(str(arg)) for arg in cmd_args]
|
|
cmd = cmd_str % tuple(cmd_args)
|
|
return subprocess.run(cmd, shell=shell)
|