From c4cd1e2c165c4f34ebf67fa9350f8732b2aeca13 Mon Sep 17 00:00:00 2001 From: Rory Dudley Date: Tue, 4 Jun 2024 16:25:32 -0600 Subject: Updated the way built-in commands are called/used Previously, built-in commands were fairly primitive, merely outputting STDOUT and STDERR with the print! macros. However, we need them to behave like normal programs, that is: - Acknowledge their verse's meter (forking, piping, etc.), - Ability to capture STDOUT and STDERR (>, 2>), - and Affect the currently running environment. For these reasons, the anthology was reworked, and now contains the Anthology struct, which mimics both std::process::{Child, Command}. The AnthologyStdin helper struct was also created, for built-ins to take input on STDIN, though no built-in is currently using it. Each built-ins' incant functions were updated to return a std::process::Output. It contains output from STDOUT, output from STDERR, and the exit code of the "process". A fix was also implemented for aliases, where the STDOUT and STDERR vectors were not being copied to the newly constructed verse. --- src/compose/environment.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/compose') diff --git a/src/compose/environment.rs b/src/compose/environment.rs index ea6d070..18d59c4 100644 --- a/src/compose/environment.rs +++ b/src/compose/environment.rs @@ -24,6 +24,7 @@ use std::collections::HashMap; /// () /// } /// ``` +#[derive(Debug, PartialEq, Eq, Clone)] pub struct Environment { pub aliases: HashMap, pub bins: Vec, -- cgit v1.2.3