Skip to content

Commit

Permalink
Remove shell=True (#300)
Browse files Browse the repository at this point in the history
Signed-off-by: maipbui <maibui@microsoft.com>

Signed-off-by: maipbui <maibui@microsoft.com>
  • Loading branch information
maipbui authored Sep 27, 2022
1 parent 143422b commit 3622aac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ def get_pcie_device(self):
pciList = []
p1 = "^(\w+):(\w+)\.(\w)\s(.*)\s*\(*.*\)*"
p2 = "^.*:.*:.*:(\w+)\s*\(*.*\)*"
command1 = "sudo lspci"
command2 = "sudo lspci -n"
command1 = ["sudo", "lspci"]
command2 = ["sudo", "lspci", "-n"]
# run command 1
proc1 = subprocess.Popen(command1, shell=True, universal_newlines=True, stdout=subprocess.PIPE)
proc1 = subprocess.Popen(command1, universal_newlines=True, stdout=subprocess.PIPE)
output1 = proc1.stdout.readlines()
(out, err) = proc1.communicate()
# run command 2
proc2 = subprocess.Popen(command2, shell=True, universal_newlines=True, stdout=subprocess.PIPE)
proc2 = subprocess.Popen(command2, universal_newlines=True, stdout=subprocess.PIPE)
output2 = proc2.stdout.readlines()
(out, err) = proc2.communicate()

Expand Down
2 changes: 1 addition & 1 deletion sonic-xcvrd/xcvrd/xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ def is_fast_reboot_enabled():
keys = fastboot_tbl.getKeys()

if "system" in keys:
output = subprocess.check_output('sonic-db-cli STATE_DB get "FAST_REBOOT|system"', shell=True, universal_newlines=True)
output = subprocess.check_output(['sonic-db-cli', 'STATE_DB', 'get', "FAST_REBOOT|system"], universal_newlines=True)
if "1" in output:
fastboot_enabled = True

Expand Down

0 comments on commit 3622aac

Please sign in to comment.