stage3: Fetcher.fetch_stage: Pass stderr fd to wget

The main entry point of the `mkvm` program closes FD 3 (native stderr)
to prevent extraneous messages from libvirt. Unfortunately, this breaks
wget's progress indicator, as it is printed to stderr as well. To ensure
that the progress indicator works, we have to pass the FD of the copy of
stderr to wget.
master
Dustin 2015-07-11 17:40:54 -05:00
parent 6dbc137b3a
commit e28238dc33
1 changed files with 2 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import io
import os import os
import shutil import shutil
import subprocess import subprocess
import sys
import time import time
import urllib.parse import urllib.parse
import urllib.request import urllib.request
@ -102,7 +103,7 @@ class Fetcher(object):
cmd += uris cmd += uris
log.debug('Running command: {}'.format(' '.join(cmd))) log.debug('Running command: {}'.format(' '.join(cmd)))
try: try:
p = subprocess.Popen(cmd, cwd=self.cache_dir) p = subprocess.Popen(cmd, cwd=self.cache_dir, stderr=sys.stderr)
except OSError as e: except OSError as e:
raise FetchError('Failed to run wget: {}'.format(e)) raise FetchError('Failed to run wget: {}'.format(e))
if p.wait() != 0: if p.wait() != 0: