From bf4e24212917a4b3df6a6e885e2148a89ead0aa8 Mon Sep 17 00:00:00 2001 From: douglas-raillard-arm Date: Fri, 20 Nov 2020 21:13:38 +0000 Subject: [PATCH] host: Use "sh -c" for background() like execute() Align LocalConnection.background() and LocalConnection.execute() by using "sh -c" when running with sudo. --- devlib/host.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devlib/host.py b/devlib/host.py index 01dd9c9..fcd48cb 100644 --- a/devlib/host.py +++ b/devlib/host.py @@ -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 -- sh -c {}".format(quote(password), quote(command)) # Make sure to get a new PGID so PopenBackgroundCommand() can kill # all sub processes that could be started without troubles.