From 85036fbb303681cc09bbf7800aac1a9e4648a247 Mon Sep 17 00:00:00 2001
From: Sergei Trofimov <sergei.trofimov@arm.com>
Date: Wed, 12 Jul 2017 13:44:47 +0100
Subject: [PATCH] utils/android: better error message when exit code not
 detected

Include the stdout/stderr output in the message of the exception raised
when the exit code of the adb command cannot be detected.
---
 devlib/utils/android.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/devlib/utils/android.py b/devlib/utils/android.py
index f683190..e8ca78d 100644
--- a/devlib/utils/android.py
+++ b/devlib/utils/android.py
@@ -381,8 +381,9 @@ def adb_shell(device, command, timeout=None, check_exit_code=False,
                 raise TargetError(message.format(re_search[0]))
             else:
                 message = 'adb has returned early; did not get an exit code. '\
-                          'Was kill-server invoked?'
-                raise TargetError(message)
+                          'Was kill-server invoked?\nOUTPUT:\n-----\n{}\n'\
+                          '-----\nERROR:\n-----\n{}\n-----'
+                raise TargetError(message.format(raw_output, error))
 
     return output