aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonas Maier <>2026-03-08 08:48:14 +0100
committerJonas Maier <>2026-03-08 08:48:14 +0100
commit5dd3abb3b4642cd42e532805a8b0c334025c0d10 (patch)
tree4348eb4ecf243dc74168ba43bbc393201a79092d /src
parentc90c781a32af4304e647231be2a74a444f632a99 (diff)
downloadpish-5dd3abb3b4642cd42e532805a8b0c334025c0d10.tar.gz
null builtin
Diffstat (limited to 'src')
-rw-r--r--src/run/builtin.rs17
-rw-r--r--src/run/mod.rs3
2 files changed, 18 insertions, 2 deletions
diff --git a/src/run/builtin.rs b/src/run/builtin.rs
index c3153d6..4f7b9ed 100644
--- a/src/run/builtin.rs
+++ b/src/run/builtin.rs
@@ -352,3 +352,20 @@ impl Builtin for parse {
Ok(())
}
}
+
+pub struct null;
+impl Builtin for null {
+ fn name(&self) -> &str {
+ "null"
+ }
+
+ fn io(
+ &self,
+ _session: Arc<Mutex<Session>>,
+ _args: &[BString],
+ _stdin: &mut dyn Read,
+ _stdout: &mut dyn Write,
+ ) -> Result {
+ Ok(())
+ }
+}
diff --git a/src/run/mod.rs b/src/run/mod.rs
index d386590..8c36f91 100644
--- a/src/run/mod.rs
+++ b/src/run/mod.rs
@@ -155,7 +155,6 @@ impl Executor {
Ok(Err(e)) => match e {
BuiltinError::IO(_) => code = -1,
BuiltinError::Exit(c) => code = c,
- BuiltinError::ParseError(_) => code = -2,
},
Err(_) => code = 127,
}
@@ -291,7 +290,6 @@ pub fn run(se: Arc<Mutex<Session>>, cmd: Vec<u8>) {
#[derive(Debug)]
pub enum BuiltinError {
IO(std::io::Error),
- ParseError(&'static str),
Exit(i32),
}
@@ -332,6 +330,7 @@ const BUILTINS: &[&'static dyn Builtin] = &[
&builtin::history,
&builtin::escape,
&builtin::parse,
+ &builtin::null,
];
pub fn builtin_map() -> HashMap<BString, &'static dyn Builtin> {