diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2019-11-09 13:29:20 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-11-09 15:51:09 +0100 |
commit | 01db294700a594b9b004855097b3bcfee9946d61 (patch) | |
tree | 09e6dc72351ca57273ea919b9ced1790b567601f | |
parent | 7b6e5eafbaadd1cd898cd3cf78b7559b98d7af81 (diff) |
Add Runtime::input_is_pipe()
We need this because we might want to check whether we can get the STDIN
handle from the runtime or not.
In some (rare) cases, the runtime "thinks" that STDIN is a stream of
IDs, but it is not. So the client can check whether stdin is a pipe
(thus, whether Runtime thinks that there's a stream of IDs) and easily
work around that by taking ::std::io::stdin() itself.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | lib/core/libimagrt/src/runtime.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/core/libimagrt/src/runtime.rs b/lib/core/libimagrt/src/runtime.rs index 89587487..d8997a8b 100644 --- a/lib/core/libimagrt/src/runtime.rs +++ b/lib/core/libimagrt/src/runtime.rs @@ -336,10 +336,6 @@ impl<'a> Runtime<'a> { &self.cli_matches } - pub fn ids_from_stdin(&self) -> bool { - self.has_input_pipe - } - pub fn ids<T: IdPathProvider>(&self) -> Result<Option<Vec<StoreId>>> { use std::io::Read; @@ -410,6 +406,16 @@ impl<'a> Runtime<'a> { self.has_output_pipe } + pub fn input_is_pipe(&self) -> bool { + self.has_input_pipe + } + + /// Alias for Runtime::input_is_pipe() + pub fn ids_from_stdin(&self) -> bool { + self.input_is_pipe() + } + + /// Check whether the runtime ignores touched ids /// /// "Ignoring" in this context means whether the runtime prints them or not. |