process_terminal/
functions.rs1use {
2 crate::{ProcessSettings, TERMINAL},
3 anyhow::Result,
4 std::process::Child,
5};
6
7#[macro_export]
8macro_rules! tprintln {
10 ($($arg:tt)*) => {
11 if cfg!(debug_assertions) {
12 process_terminal::TERMINAL.add_message(format!($($arg)*));
13 }
14 };
15}
16
17pub fn add_process(name: &str, child: Child, settings: ProcessSettings) -> Result<()> {
19 TERMINAL.add_process(name, child, settings)
20}
21
22pub fn block_search_message<S, P>(process: P, submsg: S) -> Result<String>
24where
25 S: ToString,
26 P: ToString,
27{
28 TERMINAL.block_search_message(process, submsg)
29}
30
31pub fn end_terminal() {
32 TERMINAL.kill();
33}
34
35pub fn with_exit_callback<F: Fn() + Send + Sync + 'static>(closure: F) {
36 TERMINAL.with_exit_callback(closure);
37}