Merge branch 'master' of 141.30.224.77:23]:hodasemi/RMusicBot
This commit is contained in:
commit
fe2ea7eeea
1 changed files with 15 additions and 2 deletions
|
@ -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));
|
||||||
|
|
Loading…
Reference in a new issue