mtreplay: print replay subprocess stderr on error

In touch tests, if the replay subprocess returns an error it's helpful
to know the error code and the contents of standard error for that
process.

BUG=none
TEST=run a touch test that causes a replay error, check stderr is
     displayed. (I checked with the zgb/1f_click_resting_thumb test.)

Change-Id: Ifde360ca293bdce8582343372520a6275da88b42
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/mttools/+/2140752
Tested-by: Harry Cutts <hcutts@chromium.org>
Reviewed-by: Sean O'Brien <seobrien@chromium.org>
Commit-Queue: Harry Cutts <hcutts@chromium.org>
diff --git a/mtreplay/mtreplay.py b/mtreplay/mtreplay.py
index 89f1dfe..98cbe19 100755
--- a/mtreplay/mtreplay.py
+++ b/mtreplay/mtreplay.py
@@ -297,7 +297,7 @@
       parameters = ['gdb', '--args'] + parameters
 
     dbg_log.info("Executing: %s", " ".join(parameters))
-    process = Popen(parameters, env=self._env, cwd=working_dir)
+    process = Popen(parameters, env=self._env, cwd=working_dir, stderr=PIPE)
     process.wait()
     dbg_log.info("Process returns: %d", process.returncode)
 
@@ -320,4 +320,7 @@
     if process.returncode != 0:
       print('Gestures Log: ')
       print(self.gestures_log)
-      raise Exception('Process error: ', ' '.join(parameters))
+      print('Standard error:')
+      print(process.stderr.read())
+      raise Exception('Error {} from process: {}'
+              .format(process.returncode, ' '.join(parameters)))