mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-14 20:33:41 +00:00
9 lines
228 B
Python
9 lines
228 B
Python
import re
|
|
import subprocess
|
|
import shlex
|
|
|
|
|
|
def safe_run_cmd(cmd_str, cmd_args=(), shell=True):
|
|
cmd_args = [shlex.quote(arg) for arg in cmd_args]
|
|
cmd = cmd_str % tuple(cmd_args)
|
|
return subprocess.run(cmd, shell=shell) |