tests/printenv.py
changeset 41039 73da729ccfef
parent 41028 3c5aaea9638f
child 43076 2372284d9457
--- a/tests/printenv.py	Fri Dec 21 05:08:32 2018 +0100
+++ b/tests/printenv.py	Wed Dec 19 15:45:29 2018 +0100
@@ -37,6 +37,11 @@
 parser.add_argument(
     "out", nargs="?", default=None, help="where to write the output"
 )
+parser.add_argument(
+    "--line",
+    action="store_true",
+    help="print environment variables one per line instead of on a single line",
+)
 args = parser.parse_args()
 
 if args.out is None:
@@ -56,9 +61,18 @@
     filter = lambda x: x.replace('\\', '/')
 else:
     filter = lambda x: x
+
 vars = [b"%s=%s" % (k.encode('ascii'), filter(v).encode('ascii'))
         for k, v in env]
-out.write(b" ".join(vars))
+
+# Print variables on out
+if not args.line:
+    out.write(b" ".join(vars))
+else:
+    for var in vars:
+        out.write(var)
+        out.write(b"\n")
+
 out.write(b"\n")
 out.close()