1
0
mirror of https://github.com/ARM-software/devlib.git synced 2024-10-06 10:50:51 +01:00

Added quotes around commands using raw paths

This fixes issues with spaces in path names.
This commit is contained in:
Sebastian Goscik 2016-02-15 15:27:19 +00:00
parent aab487c1ac
commit 1424cebb90
2 changed files with 9 additions and 9 deletions

View File

@ -772,17 +772,17 @@ class AndroidTarget(Target):
self.conn.push(source, dest, timeout=timeout)
else:
device_tempfile = self.path.join(self._file_transfer_cache, source.lstrip(self.path.sep))
self.execute('mkdir -p {}'.format(self.path.dirname(device_tempfile)))
self.execute("mkdir -p '{}'".format(self.path.dirname(device_tempfile)))
self.conn.push(source, device_tempfile, timeout=timeout)
self.execute('cp {} {}'.format(device_tempfile, dest), as_root=True)
self.execute("cp '{}' '{}'".format(device_tempfile, dest), as_root=True)
def pull(self, source, dest, as_root=False, timeout=None): # pylint: disable=arguments-differ
if not as_root:
self.conn.pull(source, dest, timeout=timeout)
else:
device_tempfile = self.path.join(self._file_transfer_cache, source.lstrip(self.path.sep))
self.execute('mkdir -p {}'.format(self.path.dirname(device_tempfile)))
self.execute('cp {} {}'.format(source, device_tempfile), as_root=True)
self.execute("mkdir -p '{}'".format(self.path.dirname(device_tempfile)))
self.execute("cp '{}' '{}'".format(source, device_tempfile), as_root=True)
self.conn.pull(device_tempfile, dest, timeout=timeout)
# Android-specific
@ -829,7 +829,7 @@ class AndroidTarget(Target):
def install_apk(self, filepath, timeout=None): # pylint: disable=W0221
ext = os.path.splitext(filepath)[1].lower()
if ext == '.apk':
return adb_command(self.adb_name, "install {}".format(filepath), timeout=timeout)
return adb_command(self.adb_name, "install '{}'".format(filepath), timeout=timeout)
else:
raise TargetError('Can\'t install {}: unsupported format.'.format(filepath))
@ -842,7 +842,7 @@ class AndroidTarget(Target):
if on_device_file != on_device_executable:
self.execute('cp {} {}'.format(on_device_file, on_device_executable), as_root=self.is_rooted)
self.remove(on_device_file, as_root=self.is_rooted)
self.execute('chmod 0777 {}'.format(on_device_executable), as_root=self.is_rooted)
self.execute("chmod 0777 '{}'".format(on_device_executable), as_root=self.is_rooted)
self._installed_binaries[executable_name] = on_device_executable
return on_device_executable

View File

@ -167,7 +167,7 @@ class AdbConnection(object):
def push(self, source, dest, timeout=None):
if timeout is None:
timeout = self.timeout
command = 'push {} {}'.format(source, dest)
command = "push '{}' '{}'".format(source, dest)
return adb_command(self.device, command, timeout=timeout)
def pull(self, source, dest, timeout=None):
@ -179,10 +179,10 @@ class AdbConnection(object):
command = 'shell ls {}'.format(source)
output = adb_command(self.device, command, timeout=timeout)
for line in output.splitlines():
command = 'pull {} {}'.format(line, dest)
command = "pull '{}' '{}'".format(line, dest)
adb_command(self.device, command, timeout=timeout)
return
command = 'pull {} {}'.format(source, dest)
command = "pull '{}' '{}'".format(source, dest)
return adb_command(self.device, command, timeout=timeout)
def execute(self, command, timeout=None, check_exit_code=False, as_root=False):