interactive_read_eval_loop

Function interactive_read_eval_loop 

Source
pub async fn interactive_read_eval_loop(
    env: &RefCell<&mut Env>,
    lexer: &mut Lexer<'_>,
) -> Result
Expand description

read_eval_loop for interactive shells

This function extends the read_eval_loop function to act as an interactive shell. The difference is that this function suppresses Interrupts and continues the loop if the parser fails with a syntax error or if the command execution results in an interrupt. Note that I/O errors detected by the parser are not recovered from.

Also note that the following aspects of the interactive shell are not implemented in this function:

  • Prompting the user for input (see the yash-prompt crate)
  • Reporting job status changes before the prompt (see Reporter)
  • Applying the ignore-eof option (see IgnoreEof)

This function is intended to be used as the top-level read-eval loop in an interactive shell. It is not suitable for non-interactive command execution such as scripts. See read_eval_loop for non-interactive execution.