Closed stefanofornari closed 6 years ago
Today's status:
TODO:
(*) I am not sure yet which version of beanshell I can include. It cannot be a snapshot, therefore maybe it will be b06 until a not-snapshot of beanshell is tagged.
identifying two states for beanshell interpreter: PARSE and EXECUTE; a statement will then be run in a separate interruptable thread; upon Ctrl+C, if the interpreter is in PARSE status, the current input will be discarded as it is now; if instead the interpreter is in EXECUTE status, the exec thread/task is interrupted.
Or if you just always treat it as "EXECUTE" you solve both problems and in a supported fashion without hacking the parser.
yeah, that is how it is today. which forces you to shutdown the Interpreter (not the parser) in all cases. Instead, I would like to interrupt the running thread when the interpreter is in EXECUTE and just re-initialize the parser when it is in PARSE. there is no need to shutdown the Interpreter and then recreate it.
At the end no additional status was needed for now, I am just checking if there is a task running. @nickl-, let me know if you are interested into a PR for this. I see it as a minimal compatible change: it just moves node.eval() in a separate thread using an executor. in the future we may think of having something like Ctrl+Z to send the execution of a command in the background. No changes to the interface are needed.
@stefanofornari I am not sucre what exactly you are referring to, please assist by pointing me to the code in question.
@nickl-, sorry if I was not clear. you may refer to this commit https://github.com/stefanofornari/BshConsole/commit/22715379119e6a30ddb2bb35376b2ec583c8a851 , in particular:
Object ret = null;
will = executor.submit(new Callable() {
@Override
public Object call() throws Exception {
return node.eval(callstack, THIS);
}
});
try {
ret = will.get();
} catch (Throwable t) {
if (t.getCause() instanceof TargetError) {
throw (TargetError)t.getCause();
}
}
@stefanofornari it seems overly complicated =(
A first bunch of known issues have been fixed and the console is now ready for prime time. Basic features are:
TODO:
(*) I am not sure yet which version of beanshell I can include. It cannot be a snapshot, therefore maybe it will be b06 until a not-snapshot of beanshell is tagged.