diff --git a/src/builtins/mod.rs b/src/builtins/mod.rs index b2d257a..f883519 100644 --- a/src/builtins/mod.rs +++ b/src/builtins/mod.rs @@ -9,6 +9,7 @@ mod fetch; mod ls; mod open; mod pwd; +mod segfault; pub struct BuiltinConfig { pub prompt_style: PromptStyle, @@ -35,6 +36,7 @@ const BUILTINS: Lazy)>> = Lazy::new(|| { ("open", Box::new(open::Open)), ("fetch", Box::new(fetch::Fetch)), ("ls", Box::new(ls::Ls)), + ("segfault", Box::new(segfault::Segfault)), ] }); diff --git a/src/builtins/segfault.rs b/src/builtins/segfault.rs new file mode 100644 index 0000000..396d234 --- /dev/null +++ b/src/builtins/segfault.rs @@ -0,0 +1,11 @@ +use crate::builtins::{Builtin, BuiltinConfig}; +use crate::error::ShellError; + +pub struct Segfault; + +impl Builtin for Segfault { + fn execute(&mut self, _: &mut BuiltinConfig, _: Vec) -> Result<(), ShellError> { + unsafe { std::ptr::null_mut::().write(69) }; + Ok(()) + } +}