Skip to main content

commandnotfound

Function commandnotfound 

Source
pub fn commandnotfound(arg0: &str, args: &mut Vec<String>) -> i32
Expand description

Port of int commandnotfound(char *arg0, LinkList args) from Src/exec.c:669.

C body:

Shfunc shf = (Shfunc)
    shfunctab->getnode(shfunctab, "command_not_found_handler");
if (!shf) {
    lastval = 127;
    return 1;
}
pushnode(args, arg0);
lastval = doshfunc(shf, args, 1);
return 0;

Look up the user-defined command_not_found_handler shfunc and invoke it with arg0 prepended to args. Returns 0 if handled, 1 if no handler (so caller emits the standard “command not found” error). Sets $? to 127 in the no-handler path.