Quit the program?

C ++ has System.exit(0) , VB has End , C # has Application.Exit

How to exit the program in Smalltalk? I use Faro. Note. I am not going to exit Pharo itself, but simply terminate my program during this specific instruction.

I found how to get out of Pharo itself, but again this is not what I'm looking for: Smalltalk exit: 0.

Thanks for any help!

+5
source share
1 answer

Your question actually consists of two parts. Thus, exit from Faro itself is equivalent to System.exit(0) . Since the system starts the C ++ process and then exits, the same goes for Pharo.

So go ahead: you can think of starting another pharo image from your current one and stop the process itself if you want.

You are actually asking how to get out of some part of the code executed in Pharo. And this is a difficult question, because you also need to answer where is the border between your code and Pharo. I think it depends on your implementation. Perhaps this is enough to close the window or remove an instance of your class from somewhere.

If you want to use a more general approach, you can start execution in a separate pharo process using [ ] fork , and then stop it by sending it suspend or terminate (you can get the active process using Processor activeProcess ). Alternatively, you can make thisContext terminate .

+5
source

Source: https://habr.com/ru/post/1243910/


All Articles