Skip to main content

bctx_forge/substrate/
null.rs

1use super::{Substrate, SubstrateCommand, SubstrateError, SubstrateResult};
2
3/// Dry-run substrate — records calls but never spawns processes.
4#[derive(Default)]
5pub struct NullSubstrate {
6    pub recorded: std::sync::Mutex<Vec<SubstrateCommand>>,
7}
8
9impl Substrate for NullSubstrate {
10    fn execute(&self, cmd: SubstrateCommand) -> Result<SubstrateResult, SubstrateError> {
11        self.recorded.lock().unwrap().push(cmd);
12        Ok(SubstrateResult {
13            stdout: b"[dry-run: no output]".to_vec(),
14            stderr: Vec::new(),
15            exit_code: 0,
16            duration_ms: 0,
17        })
18    }
19
20    fn is_available(&self) -> bool {
21        true
22    }
23}