From 1f50b0ffc22cf4c826b9fdb6fdc89c8524866881 Mon Sep 17 00:00:00 2001 From: Douglas RAILLARD Date: Tue, 30 Oct 2018 16:19:46 +0000 Subject: [PATCH] quoting: Use shlex.split instead of str.split Split command lines using str.split ignores the quoting. Fixes that by using shlex.split. --- devlib/instrument/acmecape.py | 3 ++- devlib/platform/gem5.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/devlib/instrument/acmecape.py b/devlib/instrument/acmecape.py index 329c9ee..42728e6 100644 --- a/devlib/instrument/acmecape.py +++ b/devlib/instrument/acmecape.py @@ -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() diff --git a/devlib/platform/gem5.py b/devlib/platform/gem5.py index f197f97..9fa8254 100644 --- a/devlib/platform/gem5.py +++ b/devlib/platform/gem5.py @@ -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)