Mercurial > public > mercurial-scm > hg
diff tests/printenv.py @ 4643:a39cec1d5cb8
printenv: filter empty environment variables for portability.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Wed, 20 Jun 2007 22:06:37 +0200 |
parents | 4fd6f7e60894 |
children | 7a7d4937272b |
line wrap: on
line diff
--- a/tests/printenv.py Wed Jun 20 22:05:43 2007 +0200 +++ b/tests/printenv.py Wed Jun 20 22:06:37 2007 +0200 @@ -25,7 +25,10 @@ if len(sys.argv) > 3: out = open(sys.argv[3], "ab") -env = [v for v in os.environ if v.startswith("HG_")] +# variables with empty values may not exist on all platforms, filter +# them now for portability sake. +env = [k for k,v in os.environ.iteritems() + if k.startswith("HG_") and v] env.sort() # edit the variable part of the variable