From b1538fd1843265df5c8057db60128c675e43d174 Mon Sep 17 00:00:00 2001 From: douglas-raillard-arm Date: Wed, 18 Nov 2020 17:15:38 +0000 Subject: [PATCH] host: remove unneeded concatenation '{}'.format(x) + y is equivalent to '{}{}'.format(x, y) --- devlib/host.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devlib/host.py b/devlib/host.py index 5869d14..01dd9c9 100644 --- a/devlib/host.py +++ b/devlib/host.py @@ -102,7 +102,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) @@ -127,7 +127,7 @@ class LocalConnection(ConnectionBase): password = self._get_password() # The sudo prompt will add a space on stderr, but we cannot filter # it out here - 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.