Mercurial > hg > truffle
changeset 5091:54819cdcca7f
Added -V option to mx for 'very verbose'which prints the environment variables used for an external command.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 16 Mar 2012 14:48:15 +0100 |
parents | 0a1e5b876667 |
children | 3d91d5d7b166 |
files | mxtool/mx.py |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mxtool/mx.py Fri Mar 16 14:47:23 2012 +0100 +++ b/mxtool/mx.py Fri Mar 16 14:48:15 2012 +0100 @@ -510,6 +510,7 @@ ArgumentParser.__init__(self, prog='mx') self.add_argument('-v', action='store_true', dest='verbose', help='enable verbose output') + self.add_argument('-V', action='store_true', dest='very_verbose', help='enable very verbose output') self.add_argument('--dbg', type=int, dest='java_dbg_port', help='make Java processes wait on <port> for a debugger', metavar='<port>') self.add_argument('-d', action='store_const', const=8000, dest='java_dbg_port', help='alias for "-dbg 8000"') self.add_argument('--cp-pfx', dest='cp_prefix', help='class path prefix', metavar='<arg>') @@ -536,6 +537,9 @@ opts.__dict__.setdefault('timeout', 0) opts.__dict__.setdefault('ptimeout', 0) + if opts.very_verbose: + opts.verbose = True + if opts.java_home is None: opts.java_home = os.environ.get('JAVA_HOME') @@ -640,6 +644,10 @@ assert isinstance(arg, types.StringTypes), 'argument is not a string: ' + str(arg) if _opts.verbose: + if _opts.very_verbose: + log('Environment variables:') + for key in sorted(os.environ.keys()): + log(' ' + key + '=' + os.environ[key]) log(' '.join(args)) if timeout is None and _opts.ptimeout != 0: @@ -697,7 +705,10 @@ if retcode and nonZeroIsFatal: if _opts.verbose: - raise subprocess.CalledProcessError(retcode, ' '.join(args)) + if _opts.very_verbose: + raise subprocess.CalledProcessError(retcode, ' '.join(args)) + else: + log('[exit code: ' + str(retcode)+ ']') abort(retcode) return retcode