Skip to content

Commit

Permalink
Fix command in subprocess
Browse files Browse the repository at this point in the history
Signed-off-by: maipbui <maibui@microsoft.com>
  • Loading branch information
maipbui committed Aug 16, 2022
1 parent 9ca1d96 commit ca56944
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions device/celestica/x86_64-cel_e1031-r0/sonic_platform/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import imp
import yaml
import subprocess
from shlex import quote, split
from shlex import split
from sonic_py_common import device_info


Expand Down Expand Up @@ -48,7 +48,7 @@ def run_command(self, command):
output = ""
try:
p = subprocess.Popen(
split(quote(command)), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
raw_data, err = p.communicate()
if p.returncode == 0:
status, output = True, raw_data.strip()
Expand Down Expand Up @@ -196,7 +196,7 @@ def write_txt_file(self, file_path, value):
return True

def is_host(self):
command = split(quote(self.HOST_CHK_CMD))
command = split(self.HOST_CHK_CMD)
return subprocess.run(command).returncode == 0

def load_json_file(self, path):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import os.path
import shutil
import subprocess
from shlex import quote, split
from shlex import split
from sonic_platform_base.component_base import ComponentBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
Expand Down Expand Up @@ -40,7 +40,7 @@ def __run_command(self, command):
# Run bash command and print output to stdout
try:
process = subprocess.Popen(
split(quote(command)), universal_newlines=True, stdout=subprocess.PIPE)
split(command), universal_newlines=True, stdout=subprocess.PIPE)
while True:
output = process.stdout.readline()
if output == '' and process.poll() is not None:
Expand All @@ -65,7 +65,7 @@ def get_register_value(self, register):
# Retrieves the cpld register value
cmd = "echo {1} > {0}; cat {0}".format(GETREG_PATH, register)
p = subprocess.Popen(
split(quote(cmd)), universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
split(cmd), universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
raw_data, err = p.communicate()
if err is not '':
return None
Expand Down

0 comments on commit ca56944

Please sign in to comment.