1
Fork 0

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) print("downloading {}".format(url), file=sys.stderr)
try: try:
if probably_big or verbose: if (probably_big or verbose) and "GITHUB_ACTIONS" not in os.environ:
option = "-#" option = "-#"
else: else:
option = "-s" option = "-s"

View file

@ -7,7 +7,7 @@ use std::{
process::{Command, Stdio}, process::{Command, Stdio},
}; };
use build_helper::util::try_run; use build_helper::{util::try_run, ci::CiEnv};
use once_cell::sync::OnceCell; use once_cell::sync::OnceCell;
use xz2::bufread::XzDecoder; use xz2::bufread::XzDecoder;
@ -213,7 +213,6 @@ impl Config {
// Try curl. If that fails and we are on windows, fallback to PowerShell. // Try curl. If that fails and we are on windows, fallback to PowerShell.
let mut curl = Command::new("curl"); let mut curl = Command::new("curl");
curl.args(&[ curl.args(&[
"-#",
"-y", "-y",
"30", "30",
"-Y", "-Y",
@ -224,6 +223,12 @@ impl Config {
"3", "3",
"-SRf", "-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); curl.arg(url);
let f = File::create(tempfile).unwrap(); let f = File::create(tempfile).unwrap();
curl.stdout(Stdio::from(f)); curl.stdout(Stdio::from(f));