Skip to content

Commit 45572a1

Browse files
authored
Merge pull request helium#207 from helium/madninja/stdin_flag
Adds a —stdin option
2 parents e5767d7 + 7e20e11 commit 45572a1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ pub struct Cli {
2020
#[structopt(long)]
2121
daemon: bool,
2222

23+
/// Monitor stdin and terminate when stdin closes.
24+
///
25+
/// This flag is not cmopatible with the daemon flag
26+
#[structopt(long)]
27+
stdin: bool,
28+
2329
#[structopt(subcommand)]
2430
cmd: Cmd,
2531
}
@@ -98,7 +104,7 @@ pub fn main() -> Result {
98104
loop {
99105
tokio::select!(
100106
_ = signal::ctrl_c() => break,
101-
read = stdin.read(&mut in_buf), if !cli.daemon => if let Ok(0) = read { break },
107+
read = stdin.read(&mut in_buf), if cli.stdin => if let Ok(0) = read { break },
102108
)
103109
}
104110
shutdown_trigger.trigger()

0 commit comments

Comments
 (0)