mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-04 07:51:21 +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:
		
				
					committed by
					
						
						Marc Bonnici
					
				
			
			
				
	
			
			
			
						parent
						
							ed7f0e56a2
						
					
				
				
					commit
					1f50b0ffc2
				
			@@ -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()
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user