Skip to content

Commit ca56944

Browse files
committed
Fix command in subprocess
Signed-off-by: maipbui <[email protected]>
1 parent 9ca1d96 commit ca56944

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

device/celestica/x86_64-cel_e1031-r0/sonic_platform/common.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import imp
44
import yaml
55
import subprocess
6-
from shlex import quote, split
6+
from shlex import split
77
from sonic_py_common import device_info
88

99

@@ -48,7 +48,7 @@ def run_command(self, command):
4848
output = ""
4949
try:
5050
p = subprocess.Popen(
51-
split(quote(command)), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
51+
split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
5252
raw_data, err = p.communicate()
5353
if p.returncode == 0:
5454
status, output = True, raw_data.strip()
@@ -196,7 +196,7 @@ def write_txt_file(self, file_path, value):
196196
return True
197197

198198
def is_host(self):
199-
command = split(quote(self.HOST_CHK_CMD))
199+
command = split(self.HOST_CHK_CMD)
200200
return subprocess.run(command).returncode == 0
201201

202202
def load_json_file(self, path):

device/celestica/x86_64-cel_e1031-r0/sonic_platform/component.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import os.path
1212
import shutil
1313
import subprocess
14-
from shlex import quote, split
14+
from shlex import split
1515
from sonic_platform_base.component_base import ComponentBase
1616
except ImportError as e:
1717
raise ImportError(str(e) + "- required module not found")
@@ -40,7 +40,7 @@ def __run_command(self, command):
4040
# Run bash command and print output to stdout
4141
try:
4242
process = subprocess.Popen(
43-
split(quote(command)), universal_newlines=True, stdout=subprocess.PIPE)
43+
split(command), universal_newlines=True, stdout=subprocess.PIPE)
4444
while True:
4545
output = process.stdout.readline()
4646
if output == '' and process.poll() is not None:
@@ -65,7 +65,7 @@ def get_register_value(self, register):
6565
# Retrieves the cpld register value
6666
cmd = "echo {1} > {0}; cat {0}".format(GETREG_PATH, register)
6767
p = subprocess.Popen(
68-
split(quote(cmd)), universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
68+
split(cmd), universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
6969
raw_data, err = p.communicate()
7070
if err is not '':
7171
return None

0 commit comments

Comments
 (0)