Skip to content

Commit

Permalink
Remove shell=True (sonic-net#313)
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 and yxieca committed Oct 3, 2022
1 parent 77760bf commit de1bd8e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sonic_platform_base/sonic_pcie/pcie_common.py
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

0 comments on commit de1bd8e

Please sign in to comment.