1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

quoting: Use shlex.split instead of str.split

Split command lines using str.split ignores the quoting. Fixes that by
using shlex.split.
This commit is contained in:
Douglas RAILLARD 2018-10-30 16:19:46 +00:00 committed by Marc Bonnici
parent ed7f0e56a2
commit 1f50b0ffc2
2 changed files with 4 additions and 2 deletions

View File

@ -19,6 +19,7 @@ import os
import sys
import time
import tempfile
import shlex
from fcntl import fcntl, F_GETFL, F_SETFL
from string import Template
from subprocess import Popen, PIPE, STDOUT
@ -95,7 +96,7 @@ class AcmeCapeInstrument(Instrument):
self.logger.debug('ACME cape command: {}'.format(self.command))
def start(self):
self.process = Popen(self.command.split(), stdout=PIPE, stderr=STDOUT)
self.process = Popen(shlex.split(self.command), stdout=PIPE, stderr=STDOUT)
def stop(self):
self.process.terminate()

View File

@ -18,6 +18,7 @@ import subprocess
import shutil
import time
import types
import shlex
from pipes import quote
from devlib.exception import TargetStableError
@ -134,7 +135,7 @@ class Gem5SimulationPlatform(Platform):
self.gem5args_args,
self.gem5args_virtio)
self.logger.debug("gem5 command line: {}".format(command_line))
self.gem5 = subprocess.Popen(command_line.split(),
self.gem5 = subprocess.Popen(shlex.split(command_line),
stdout=self.stdout_file,
stderr=self.stderr_file)