From e23e4a036008a6f3a3356d48434615a05dcc17e0 Mon Sep 17 00:00:00 2001 From: Rory Dudley Date: Fri, 21 Jun 2024 15:40:49 -0400 Subject: Fix capturing output for internal poems Sometime when the switch to the new built-in command system was happening, we lost the logic to force the capture the output of STDOUT, mainly used for running internal poems (i.e. 'ls `ls`'). This patch adds a new field to the Environment struct, called fc (force capture). It gets set to true before running internal poems, and unset afterwards. Finally, some checks were added to the incant!() macro to properly handle STDOUT when fc is set. --- src/compose/environment.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/compose/environment.rs') diff --git a/src/compose/environment.rs b/src/compose/environment.rs index 18d59c4..151c7a5 100644 --- a/src/compose/environment.rs +++ b/src/compose/environment.rs @@ -14,6 +14,7 @@ use std::collections::HashMap; /// bins - A lookup table for +x files, constructed from the $PATH /// cs - Indication of callstack level, helpful for recursively dealing with /// aliases +/// fc - Force the capture of stdout (for internal poems) /// /// # Examples /// ``` @@ -29,6 +30,7 @@ pub struct Environment { pub aliases: HashMap, pub bins: Vec, pub cs: u8, + pub fc: bool, } impl Environment { @@ -38,6 +40,7 @@ impl Environment { aliases: HashMap::new(), bins: Vec::new(), cs: 0, + fc: false, } } } -- cgit v1.2.3