Run dump command on a runtime so it works properly.
This commit is contained in:
parent
d9e9b9e49c
commit
ee818dbfd8
1 changed files with 5 additions and 9 deletions
|
@ -1,7 +1,5 @@
|
||||||
use clap::{App, AppSettings, ArgMatches, SubCommand};
|
use clap::{App, AppSettings, ArgMatches, SubCommand};
|
||||||
use futures::Async;
|
use tokio2::runtime::Runtime;
|
||||||
use futures3::future::{FutureExt, poll_fn};
|
|
||||||
use std::task::Poll;
|
|
||||||
|
|
||||||
use super::stdin_stream;
|
use super::stdin_stream;
|
||||||
use webmetro::{
|
use webmetro::{
|
||||||
|
@ -23,9 +21,8 @@ pub fn run(_args: &ArgMatches) -> Result<(), WebmetroError> {
|
||||||
|
|
||||||
let mut events = stdin_stream().parse_ebml();
|
let mut events = stdin_stream().parse_ebml();
|
||||||
|
|
||||||
Ok(poll_fn(|cx| {
|
Runtime::new().unwrap().block_on(async {
|
||||||
// stdin is sync so Async::NotReady will never happen on this tokio version
|
while let Some(element) = events.next().await? {
|
||||||
while let Ok(Async::Ready(Some(element))) = events.poll_event(cx) {
|
|
||||||
match element {
|
match element {
|
||||||
// suppress printing byte arrays
|
// suppress printing byte arrays
|
||||||
Tracks(slice) => println!("Tracks[{}]", slice.len()),
|
Tracks(slice) => println!("Tracks[{}]", slice.len()),
|
||||||
|
@ -33,7 +30,6 @@ pub fn run(_args: &ArgMatches) -> Result<(), WebmetroError> {
|
||||||
other => println!("{:?}", other)
|
other => println!("{:?}", other)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
Poll::Ready(())
|
})
|
||||||
}).now_or_never().expect("Stdin should never go async"))
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue