Skip to content

Commit

Permalink
Clear eval_exitonfalse when setting up a new input stream.
Browse files Browse the repository at this point in the history
This causes %exit-on-false, as part of %dispatch, to be the actual trigger for the exit-on-false behavior.  The implementation context strongly implies that the current behavior is a bug.  (Why would we use %exit-on-false, whose only job is to set eval_exitonfalse to 1, and also just leave eval_exitonfalse as 1 ourselves?)

This also makes using `es -e` with any kind of overriden REPL much easier, because %prompt and other REPL hooks can no longer trigger the exit-on-false behavior.

This is one part of #73, but because this part is almost definitely just a bug, while the rest is more about design improvements, I am merging this part more unilaterally.
  • Loading branch information
jpco committed Sep 14, 2024
1 parent a7db5c5 commit b2bfcfd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion input.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,10 @@ extern List *runinput(Input *in, int runflags) {
= varlookup(dispatcher[((flags & run_printcmds) ? 1 : 0)
+ ((flags & run_noexec) ? 2 : 0)],
NULL);
if (flags & eval_exitonfalse)
if (flags & eval_exitonfalse) {
dispatch = mklist(mkstr("%exit-on-false"), dispatch);
flags &= ~eval_exitonfalse;
}
varpush(&push, "fn-%dispatch", dispatch);

repl = varlookup((flags & run_interactive)
Expand Down

0 comments on commit b2bfcfd

Please sign in to comment.