From c944d3459330648dc16a096efbe64f270f137078 Mon Sep 17 00:00:00 2001
From: Marc Bonnici <marc.bonnici@arm.com>
Date: Tue, 13 Aug 2019 11:09:51 +0100
Subject: [PATCH] utils/android: Fix echoing of commands.

The fix in commit 964fde2 caused issues with certain command structures,
for example running in the background. To prevent this run the original
command as a subshell.
---
 devlib/utils/android.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devlib/utils/android.py b/devlib/utils/android.py
index 1f7a916..0011df4 100755
--- a/devlib/utils/android.py
+++ b/devlib/utils/android.py
@@ -444,7 +444,7 @@ def adb_shell(device, command, timeout=None, check_exit_code=False,
     # command failed (https://code.google.com/p/android/issues/detail?id=3254).
     # Homogenise this behaviour by running the command then echoing the exit
     # code of the executed command itself.
-    command += r' ; echo "\n$?"'
+    command = r'({}); echo "\n$?"'.format(command)
 
     parts = ['adb']
     if adb_server is not None: