Skip to content

Commit

Permalink
Automatically detect terminal mode
Browse files Browse the repository at this point in the history
  • Loading branch information
schaefi committed Dec 16, 2024
1 parent a5045ab commit ebdd240
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion doc/podman-pilot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ OPTIONS

%interactive

Use when running interactive processes like a shell
Force interactive call style for processes like a shell.
Usually the pilot automatically detects if called in a
terminal or not. This options allows to override the
detection.

DEBUGGING
---------
Expand Down
1 change: 1 addition & 0 deletions podman-pilot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ regex = { version = "1.9" }
flakes = { version = "3.1.11", path = "../common" }
rust-ini = { version = "0.21" }
users = { version = "0.11" }
atty = { version = "0.2" }
4 changes: 3 additions & 1 deletion podman-pilot/src/podman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
use crate::defaults;
use crate::config::{RuntimeSection, config};

use atty::Stream;

use flakes::user::{User, mkdir};
use flakes::lookup::Lookup;
use flakes::io::IO;
Expand Down Expand Up @@ -520,7 +522,7 @@ pub fn call_instance(
if Lookup::is_debug() {
debug!("{:?}", call.get_args());
}
if interactive {
if interactive || atty::is(Stream::Stdout) {
call.status()?;
} else {
match call.output() {
Expand Down

0 comments on commit ebdd240

Please sign in to comment.