BECClient: add entry point for "bec" CLI and fix complicated cleanup at exit
At the moment BEC command line shell is started via a (bash) shell script. This is not portable, and it prevents fine-grained control of both BEC startup and BEC cleanup, like an example below:
BECIPythonClient
starts a thread that sleeps until main thread exits, or an exit event is set.
The "exit thread" has this logic:
- If the main thread quits -> exit thread stops,
.shutdown()
is called - If the exit event is set -> exit thread stops
Nothing ever set the exit event.
So, it seems like the purpose of the thread is to ensure .shutdown()
is called on the main thread
termination. Unless "exit event" is set, in this case the thread is just stopped.
The issue could be fixed by ensuring .shutdown()
is called when the IPython shell terminates.