From b7632fb35571f63fe28368c6508aa67fe8d775c8 Mon Sep 17 00:00:00 2001 From: Hristo Venev Date: Tue, 19 Mar 2019 17:28:09 +0200 Subject: Add some more curl args and error reporting. --- src/main.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index c56cb91..18ce199 100644 --- a/src/main.rs +++ b/src/main.rs @@ -183,18 +183,24 @@ fn fetch_source(url: &str) -> io::Result { proc.stdin(Stdio::null()); proc.stdout(Stdio::piped()); - proc.stderr(Stdio::null()); - proc.arg("--fail"); + proc.stderr(Stdio::piped()); + proc.arg("-gsSfL"); proc.arg("--fail-early"); + proc.arg("--max-time"); + proc.arg("10"); + proc.arg("--max-filesize"); + proc.arg("1M"); proc.arg("--"); proc.arg(url); let out = proc.output()?; if !out.status.success() { + let msg = String::from_utf8_lossy(&out.stderr); + let msg = msg.replace('\n', "; "); return Err(io::Error::new( io::ErrorKind::Other, - format!("Failed to download [{}]", url), + msg, )); } -- cgit