Skip to content

Commit

Permalink
enable --cmd for archived mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ynqa committed Jun 1, 2024
1 parent a6abd55 commit fa826e0
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,26 @@ async fn main() -> anyhow::Result<()> {
if args.archived {
let (tx, mut rx) = mpsc::channel(1);

tokio::spawn(async move {
stdin::streaming(
tx,
Duration::from_millis(args.retrieval_timeout_millis),
CancellationToken::new(),
)
.await
});
if let Some(cmd) = args.cmd.clone() {
tokio::spawn(async move {
cmd::execute(
&cmd,
tx,
Duration::from_millis(args.retrieval_timeout_millis),
CancellationToken::new(),
)
.await
});
} else {
tokio::spawn(async move {
stdin::streaming(
tx,
Duration::from_millis(args.retrieval_timeout_millis),
CancellationToken::new(),
)
.await
});
}

let mut queue = VecDeque::with_capacity(args.queue_capacity);
loop {
Expand Down

0 comments on commit fa826e0

Please sign in to comment.