Merge branch 'master' of 141.30.224.77:23]:hodasemi/RMusicBot

This commit is contained in:
hodasemi 2018-11-26 18:12:49 +01:00
commit fe2ea7eeea

View file

@ -52,11 +52,24 @@ pub fn youtube_dl(uri: &str) -> Result<Vec<Song>, String> {
.output() .output()
{ {
Ok(out) => out, Ok(out) => out,
Err(_) => return Err("youtube-dl error".to_string()), Err(why) => return Err(format!("youtube-dl error {:?}", why)),
}; };
if !out.status.success() { if !out.status.success() {
return Err("shell error".to_string()); let stdout = match String::from_utf8(out.stdout) {
Ok(string) => string,
Err(_) => String::new(),
};
let stderr = match String::from_utf8(out.stderr) {
Ok(string) => string,
Err(_) => String::new(),
};
return Err(format!(
"Shell error\nstdout: {}\nstderr: {}",
stdout, stderr
));
} }
let files = check_result!(convert_output(&out)); let files = check_result!(convert_output(&out));