You question actually has two parts. So exiting Pharo itself is the equivalent to System.exit(0)
. Because a system is running a C++ process, and then it exits, same applies to Pharo.
So continuing this: you may consider launching another pharo image from your current one and terminating the process itself if you want.
What you are really asking is how to exit some part of code being executed in Pharo. And this is a complicated question because you have to also answer where is the boundary between your code and Pharo. I think that it depends on your implementation. Maybe it's enough to close a window, or remove an instance of your class from somewhere.
If you want a more generic approach you can start the execution in a separate pharo process by using [ ] fork
and then stop it by either sending it suspend
or terminate
(you can get the active process with Processor activeProcess
). Alternatively you can do thisContext terminate
.