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

host: Fix string literal

String literals are concatenated automatically in Python:

   assert 'a' 'b' == 'ab'

This means that adding ' ' in the middle of a literal delimited by '
will be a no-op. Fix that by changing the literal delimiter to ".
This commit is contained in:
douglas-raillard-arm 2020-11-18 17:04:00 +00:00 committed by Marc Bonnici
parent d300b9e57f
commit a948982700

View File

@ -101,7 +101,7 @@ class LocalConnection(ConnectionBase):
if self.unrooted:
raise TargetStableError('unrooted')
password = self._get_password()
command = 'echo {} | sudo -p ' ' -S -- sh -c '.format(quote(password)) + quote(command)
command = "echo {} | sudo -p ' ' -S -- sh -c ".format(quote(password)) + quote(command)
ignore = None if check_exit_code else 'all'
try:
stdout, stderr = check_output(command, shell=True, timeout=timeout, ignore=ignore)
@ -119,7 +119,7 @@ class LocalConnection(ConnectionBase):
if self.unrooted:
raise TargetStableError('unrooted')
password = self._get_password()
command = 'echo {} | sudo -p ' ' -S '.format(quote(password)) + command
command = "echo {} | sudo -p ' ' -S ".format(quote(password)) + command
# Make sure to get a new PGID so PopenBackgroundCommand() can kill
# all sub processes that could be started without troubles.