aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorHristo Venev <hristo@venev.name>2019-03-19 17:28:09 +0200
committerHristo Venev <hristo@venev.name>2019-03-19 17:43:20 +0200
commitb7632fb35571f63fe28368c6508aa67fe8d775c8 (patch)
treec1cb172c0e8e07d89b1b597eb0b4c5b440d8fb91 /src/main.rs
parent6ddb2ca6ec02b79e63ce7eb442904f4fc91e077e (diff)
Add some more curl args and error reporting.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
1 files changed, 9 insertions, 3 deletions
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<proto::Source> {
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,
));
}