display command output while it is running
This commit is contained in:
parent
47ff64585b
commit
e18c0f8bea
1 changed files with 4 additions and 3 deletions
|
@ -125,14 +125,14 @@ fn download_audio(link: &Link) -> Result<()> {
|
|||
let cmd = "yt-dlp";
|
||||
println!("download audio for {}", link.href());
|
||||
println!("{} --extract-audio --audio-format mp3 {}", cmd, &link.href);
|
||||
let output = Command::new(cmd)
|
||||
let mut child = Command::new(cmd)
|
||||
.arg("--extract-audio")
|
||||
.arg("--audio-format")
|
||||
.arg("mp3")
|
||||
.arg(&link.href)
|
||||
.output()
|
||||
.spawn()
|
||||
.expect("Failed to execute command");
|
||||
println!("Output: {:#?}", output);
|
||||
child.wait()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -143,6 +143,7 @@ fn mark_as_downloaded(link: &Link, file_name: &str) -> Result<()> {
|
|||
let mut file = OpenOptions::new()
|
||||
.write(true)
|
||||
.append(true)
|
||||
.create(true)
|
||||
.open(file_name)
|
||||
.unwrap();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue