Limit the Quit[] and Exit[] redefinition to the arguments that the actual Quit[] and Exit[] can take

This commit is contained in:
cc-wr 2019-12-05 08:44:19 -05:00
parent 1607ff07cd
commit 6cca28f8ab

View File

@ -101,29 +101,43 @@ If[
to quit, if running under
a Jupyter console
*************************************)
Unprotect[Quit];
Quit[ourArgs___, opts:OptionsPattern[]] :=
Quit[ourArgs___] :=
Block[
{$inQuit = True},
If[
loopState["isCompleteRequestSent"],
loopState["askExit"] = True;,
Quit[ourArgs, opts];
Quit[ourArgs];
];
] /; !TrueQ[$inQuit];
] /;
(
(!TrueQ[$inQuit]) &&
(
(Length[{ourArgs}] == 0) ||
((Length[{ourArgs}] == 1) && IntegerQ[ourArgs])
)
);
Protect[Quit];
Unprotect[Exit];
Exit[ourArgs___, opts:OptionsPattern[]] :=
Exit[ourArgs___] :=
Block[
{$inExit = True},
If[
loopState["isCompleteRequestSent"],
loopState["askExit"] = True;,
Exit[ourArgs, opts];
Exit[ourArgs];
];
] /; !TrueQ[$inExit];
] /;
(
(!TrueQ[$inExit]) &&
(
(Length[{ourArgs}] == 0) ||
((Length[{ourArgs}] == 1) && IntegerQ[ourArgs])
)
);
Protect[Exit];
(************************************