diff options
author | Kornel <kornel@geekhood.net> | 2020-03-05 00:48:30 +0000 |
---|---|---|
committer | Kornel <kornel@geekhood.net> | 2020-03-05 00:48:30 +0000 |
commit | ab059eea62512bc210a60a83fbd520841f4e215c (patch) | |
tree | 73640f766f11632950e248d7aa309bfb22098955 /reindex | |
parent | a509299c8ff05e0d4dfbe23c699cef703604280f (diff) |
Runtimes
Diffstat (limited to 'reindex')
-rw-r--r-- | reindex/src/bin/discover.rs | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/reindex/src/bin/discover.rs b/reindex/src/bin/discover.rs index 192d440..2868aee 100644 --- a/reindex/src/bin/discover.rs +++ b/reindex/src/bin/discover.rs @@ -6,26 +6,30 @@ use std::io::BufRead; use std::io::Write; #[tokio::main] -async fn main() -> Result<(), Box<dyn std::error::Error>> { - let crates = KitchenSink::new_default().await?; +async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> { + let handle = tokio::runtime::Handle::current(); + handle.spawn(async { + let crates = KitchenSink::new_default().await?; - for line in io::stdin().lock().lines() { - let mut line = line?; - if line.trim().is_empty() { - continue; - } - if !line.starts_with("https://") { - line = format!("https://github.com/{}", line.trim_start_matches('/')); - } - if let Err(e) = check_repo(&line, &crates) { - eprintln!("{}: {}", line, e); - let mut src = e.source(); - while let Some(e) = src { - eprintln!(" {}", e); - src = e.source(); + for line in io::stdin().lock().lines() { + let mut line = line?; + if line.trim().is_empty() { + continue; + } + if !line.starts_with("https://") { + line = format!("https://github.com/{}", line.trim_start_matches('/')); + } + if let Err(e) = check_repo(&line, &crates) { + eprintln!("{}: {}", line, e); + let mut src = e.source(); + while let Some(e) = src { + eprintln!(" {}", e); + src = e.source(); + } } } - } + Ok::<_, Box<dyn std::error::Error + Send + Sync>>(()) + }).await??; Ok(()) } |