Skip to main content

PopenHook

Type Alias PopenHook 

Source
pub type PopenHook = fn(cmd: &[u8], mode: &[u8]) -> Result<Box<dyn LuaFileHandle>, LuaError>;
Expand description

Function-pointer signature for spawning a child process with a connected pipe, installed on GlobalState::popen_hook by the embedder.

std::process::Command is banned outside lua-cli, so lua-stdlib’s io.popen reaches the OS through this hook. None causes io.popen to raise a clean Lua error (“popen not enabled in this build”), which is appropriate for sandboxed embeddings.

mode is the Lua popen mode string — b"r" for reading the child’s stdout, b"w" for writing to the child’s stdin.