Skip to content

Commit 39959ee

Browse files
gursewak1997cgwalters
authored andcommitted
ephemeral run: Print hint when running in foreground
When running without -d, print a helpful hint explaining how to connect via SSH or view console output, avoiding confusion about the command appearing to hang. Signed-off-by: gursewak1997 <gursmangat@gmail.com>
1 parent bd4b055 commit 39959ee

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

crates/kit/src/run_ephemeral.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
//! - Ensures perfect fidelity of user options across process boundaries
8989
9090
use std::fs::File;
91-
use std::io::{BufWriter, Seek, Write};
91+
use std::io::{BufWriter, IsTerminal, Seek, Write};
9292
use std::os::unix::process::CommandExt;
9393
use std::process::{Command, Stdio};
9494

@@ -404,6 +404,18 @@ pub fn run_detached(opts: RunEphemeralOpts) -> Result<String> {
404404

405405
/// Launch privileged container with QEMU+KVM for ephemeral VM.
406406
pub fn run(opts: RunEphemeralOpts) -> Result<()> {
407+
// Print helpful hint when running in foreground mode without console
408+
if !opts.podman.detach && !opts.common.console && std::io::stderr().is_terminal() {
409+
if let Some(name) = &opts.podman.name {
410+
eprintln!(
411+
"Hint: Use 'bcvk ephemeral ssh {}' to connect, or add --console to see VM output",
412+
name
413+
);
414+
} else {
415+
eprintln!("Hint: Add --console to see VM output, or use -d for background mode");
416+
}
417+
}
418+
407419
let (mut cmd, _temp_dir) = prepare_run_command_with_temp(opts)?;
408420
// Keep _temp_dir alive until exec replaces our process
409421
// At this point our process is replaced by `podman`, we are just a wrapper for creating

0 commit comments

Comments
 (0)