don't print download progress in CI

This commit is contained in:
jyn 2023-07-09 22:12:39 -05:00
parent 26cdf7566c
commit dcd8d376cb
2 changed files with 8 additions and 3 deletions

View File

@ -97,7 +97,7 @@ def _download(path, url, probably_big, verbose, exception):
print("downloading {}".format(url), file=sys.stderr)
try:
if probably_big or verbose:
if (probably_big or verbose) and "GITHUB_ACTIONS" not in os.environ:
option = "-#"
else:
option = "-s"

View File

@ -7,7 +7,7 @@
process::{Command, Stdio},
};
use build_helper::util::try_run;
use build_helper::{util::try_run, ci::CiEnv};
use once_cell::sync::OnceCell;
use xz2::bufread::XzDecoder;
@ -213,7 +213,6 @@ fn download_http_with_retries(&self, tempfile: &Path, url: &str, help_on_error:
// Try curl. If that fails and we are on windows, fallback to PowerShell.
let mut curl = Command::new("curl");
curl.args(&[
"-#",
"-y",
"30",
"-Y",
@ -224,6 +223,12 @@ fn download_http_with_retries(&self, tempfile: &Path, url: &str, help_on_error:
"3",
"-SRf",
]);
// Don't print progress in CI; the \r wrapping looks bad and downloads don't take long enough for progress to be useful.
if CiEnv::is_ci() {
curl.arg("-s");
} else {
curl.arg("--progress-bar");
}
curl.arg(url);
let f = File::create(tempfile).unwrap();
curl.stdout(Stdio::from(f));