diff --git a/src/cli/term2.rs b/src/cli/term2.rs index 3fb22e8630..f522282a42 100644 --- a/src/cli/term2.rs +++ b/src/cli/term2.rs @@ -103,11 +103,11 @@ mod termhack { // - Disable all terminal controls on non-tty's // - Swallow errors when we try to use features a terminal doesn't have // such as setting colours when no TermInfo DB is present -pub struct AutomationFriendlyTerminal(Box + Send>) +pub(crate) struct AutomationFriendlyTerminal(Box + Send>) where T: Isatty + io::Write; -pub type StdoutTerminal = AutomationFriendlyTerminal>; -pub type StderrTerminal = AutomationFriendlyTerminal>; +pub(crate) type StdoutTerminal = AutomationFriendlyTerminal>; +pub(crate) type StderrTerminal = AutomationFriendlyTerminal>; macro_rules! swallow_unsupported { ( $call:expr ) => {{ @@ -225,14 +225,14 @@ lazy_static! { Mutex::new(term::terminfo::TermInfo::from_env().ok()); } -pub fn stdout() -> StdoutTerminal { +pub(crate) fn stdout() -> StdoutTerminal { let info_result = TERMINFO.lock().unwrap().clone(); AutomationFriendlyTerminal(termhack::make_terminal_with_fallback(info_result, || { process().stdout() })) } -pub fn stderr() -> StderrTerminal { +pub(crate) fn stderr() -> StderrTerminal { let info_result = TERMINFO.lock().unwrap().clone(); AutomationFriendlyTerminal(termhack::make_terminal_with_fallback(info_result, || { process().stderr() diff --git a/src/currentprocess.rs b/src/currentprocess.rs index 9cba2a1d83..fd5d967a58 100644 --- a/src/currentprocess.rs +++ b/src/currentprocess.rs @@ -11,11 +11,11 @@ use std::sync::{Arc, Mutex}; use rand::{thread_rng, Rng}; -pub mod argsource; -pub mod cwdsource; -pub mod filesource; +pub(crate) mod argsource; +pub(crate) mod cwdsource; +pub(crate) mod filesource; mod homethunk; -pub mod varsource; +pub(crate) mod varsource; use argsource::*; use cwdsource::*; @@ -121,7 +121,7 @@ pub fn process() -> Box { } /// Obtain the current instance of HomeProcess -pub fn home_process() -> Box { +pub(crate) fn home_process() -> Box { match PROCESS.with(|p| p.borrow().clone()) { None => panic!("No process instance"), Some(p) => p, @@ -163,7 +163,7 @@ fn clear_process() { } thread_local! { - pub static PROCESS:RefCell>> = RefCell::new(None); + pub(crate) static PROCESS:RefCell>> = RefCell::new(None); } // PID related things @@ -191,13 +191,13 @@ impl ProcessSource for OSProcess { #[derive(Clone, Debug, Default)] pub struct TestProcess { - pub cwd: PathBuf, - pub args: Vec, - pub vars: HashMap, - pub id: u64, - pub stdin: TestStdinInner, - pub stdout: TestWriterInner, - pub stderr: TestWriterInner, + pub(crate) cwd: PathBuf, + pub(crate) args: Vec, + pub(crate) vars: HashMap, + pub(crate) id: u64, + pub(crate) stdin: TestStdinInner, + pub(crate) stdout: TestWriterInner, + pub(crate) stderr: TestWriterInner, } impl TestProcess { diff --git a/src/currentprocess/argsource.rs b/src/currentprocess/argsource.rs index 4d861ca1eb..6f274a4c6c 100644 --- a/src/currentprocess/argsource.rs +++ b/src/currentprocess/argsource.rs @@ -20,7 +20,7 @@ impl ArgSource for super::OSProcess { } /// Helper for ArgSource over `Vec` -pub struct VecArgs { +pub(crate) struct VecArgs { v: Vec, i: usize, _marker: PhantomData, diff --git a/src/currentprocess/filesource.rs b/src/currentprocess/filesource.rs index 2333c4567c..1770e86180 100644 --- a/src/currentprocess/filesource.rs +++ b/src/currentprocess/filesource.rs @@ -58,7 +58,7 @@ impl BufRead for TestStdinLock<'_> { } } -pub type TestStdinInner = Arc>>; +pub(crate) type TestStdinInner = Arc>>; struct TestStdin(TestStdinInner); @@ -165,7 +165,7 @@ impl Write for TestWriterLock<'_> { } } -pub type TestWriterInner = Arc>>; +pub(crate) type TestWriterInner = Arc>>; struct TestWriter(TestWriterInner); diff --git a/tests/mock/clitools.rs b/tests/mock/clitools.rs index 3b33b774c0..4ab072faf0 100644 --- a/tests/mock/clitools.rs +++ b/tests/mock/clitools.rs @@ -600,7 +600,12 @@ where output } -pub fn run_inprocess(config: &Config, name: &str, args: I, env: &[(&str, &str)]) -> Output +pub(crate) fn run_inprocess( + config: &Config, + name: &str, + args: I, + env: &[(&str, &str)], +) -> Output where I: IntoIterator, A: AsRef,