tools/mvn.py: Print full command line on failure
Change-Id: I99b1f970313e1e7f4265e1d78deb1883dad79334
diff --git a/tools/mvn.py b/tools/mvn.py
index 0518439..80cbd60 100644
--- a/tools/mvn.py
+++ b/tools/mvn.py
@@ -16,6 +16,7 @@
from __future__ import print_function
from optparse import OptionParser
from os import path
+import pipes
from sys import stderr
from util import check_output
@@ -62,14 +63,16 @@
for spec in args.s:
artifact, packaging_type, src = spec.split(':')
+ cmds = cmd + [
+ '-DartifactId=%s' % artifact,
+ '-Dpackaging=%s' % packaging_type,
+ '-Dfile=%s' % src,
+ ]
try:
- check_output(cmd + [
- '-DartifactId=%s' % artifact,
- '-Dpackaging=%s' % packaging_type,
- '-Dfile=%s' % src,
- ])
+ check_output(cmds)
except Exception as e:
- print('%s command failed: %s' % (args.a, e), file=stderr)
+ cmds_str = ' '.join(pipes.quote(c) for c in cmds)
+ print("%s command failed: `%s`: %s" % (args.a, cmds_str, e), file=stderr)
exit(1)
with open(args.o, 'w') as fd: