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

chore: support ctrl c in logs #586

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(())
}

Loading