29398f49d016 — Steve Fink 3 months ago
[landed] Suppress noisy hg complaint on Windows
1 files changed, 5 insertions(+), 1 deletions(-)

M bin/landed
M bin/landed +5 -1
@@ 139,7 139,11 @@ def gather_revisions(revset, limit=None,
         earliest = datetime.datetime.now() - datetime.timedelta(days=datelimit)
     report_interval = 100 if args.user else 10000
     n = 0
-    process = subprocess.Popen(cmd, stdout=subprocess.PIPE, text=True, encoding='utf-8')
+    extra = {}
+    if os.name == 'nt':
+        # hg is very noisy on Windows when you close its output before it's done.
+        extra['stdout'] = subprocess.DEVNULL
+    process = subprocess.Popen(cmd, stdout=subprocess.PIPE, text=True, encoding='utf-8', **extra)
     try:
         for info in gen_revisions(iter(process.stdout.readline, '')):
             n += 1