Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
chore: support ctrl c in logs (#586)
Browse files Browse the repository at this point in the history
Fixes RVT-4211
  • Loading branch information
NathanFlurry committed Dec 1, 2024
1 parent ca90737 commit 5f1f034
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub enum SubCommand {
Signout(sign_out::Opts),
#[clap(alias = "d")]
Deploy(deploy::Opts),
#[clap(alias = "e")]
#[clap(alias = "e", alias = "env")]
Environment {
#[clap(subcommand)]
subcommand: environment::SubCommand,
Expand Down
11 changes: 11 additions & 0 deletions packages/cli/src/util/actor/logs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use anyhow::*;
use base64::{engine::general_purpose::STANDARD, Engine};
use clap::ValueEnum;
use tokio::signal;
use toolchain::rivet_api::{apis, models};
use uuid::Uuid;

Expand All @@ -21,6 +22,15 @@ pub struct TailOpts<'a> {
}

pub async fn tail(ctx: &toolchain::ToolchainCtx, opts: TailOpts<'_>) -> Result<()> {
tokio::select! {
result = inner_tail(ctx, opts) => result,
_ = signal::ctrl_c() => {
Ok(())
}
}
}

async fn inner_tail(ctx: &toolchain::ToolchainCtx, opts: TailOpts<'_>) -> Result<()> {
let mut watch_index: Option<String> = None;

let stream = match opts.stream {
Expand Down Expand Up @@ -64,3 +74,4 @@ pub async fn tail(ctx: &toolchain::ToolchainCtx, opts: TailOpts<'_>) -> Result<(

Ok(())
}

0 comments on commit 5f1f034

Please sign in to comment.