Hi,
I am running Squeak/Seaside headless on a Raspberry Pi Zero/W. Almost everything works great. I want to be able to exit Squeak with a return code that I test in a shell script. I was using this: Smalltalk snapshot: false andQuitWithExitCode: 1. to exit with a return code of 1. This works some of the time but not always. I can tell because the script logs the return code and when the exit doesn't work, there is nothing in the log. It is still in Squeak/Seaside somewhere. I took a look at #snapshot:andQuitWithExitCode: and #snapshot:andQuit:withExitCode:embedded: that it calls and found some code that I don't need, like code to save the image. I wrote: quickShutdown: exitCode "Shutdown without saving anything and exit with the exit code." Object flushDependents. Object flushEvents. Smalltalk processShutDownList: true. self quitPrimitive: exitCode. to simplify things but the problem persists. That's not really a surprise as it should be all that was getting done before. Does anyone have any ideas where it could be getting hung up? Maybe somewhere in Seaside? Thanks for any ideas. Lou -- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon |
On Wed, Oct 18, 2017 at 05:30:05PM -0400, Louis LaBrunda wrote:
> Hi, > > I am running Squeak/Seaside headless on a Raspberry Pi Zero/W. Almost everything works great. > I want to be able to exit Squeak with a return code that I test in a shell script. I was using > this: > > Smalltalk snapshot: false andQuitWithExitCode: 1. > > to exit with a return code of 1. This works some of the time but not always. I can tell > because the script logs the return code and when the exit doesn't work, there is nothing in the > log. It is still in Squeak/Seaside somewhere. > > I took a look at #snapshot:andQuitWithExitCode: and #snapshot:andQuit:withExitCode:embedded: > that it calls and found some code that I don't need, like code to save the image. > > I wrote: > > quickShutdown: exitCode > "Shutdown without saving anything and exit with the exit code." > > Object flushDependents. > Object flushEvents. > Smalltalk processShutDownList: true. > self quitPrimitive: exitCode. > > to simplify things but the problem persists. That's not really a surprise as it should be all > that was getting done before. Does anyone have any ideas where it could be getting hung up? > Maybe somewhere in Seaside? Thanks for any ideas. Hi Lou, I think there is some clever shutdown code in #snapshot:andQuitWithExitCode:. Maybe you care about that, and maybe you don't. And maybe it works reliably and maybe it does not, I don't know. But I do know that if you do "Smalltalk quitPrimitive: 7" it will definitely exit, and the $? exit code that you see in the shell will be 7. So that may be all that you need to do. Note: The clever shutdown code is probably there to try to do a reasonable cleanup for a Squeak image that might have open connections to a database session, or some other resource then should be properly cleaned up before you kill the Squeak VM process. Given that you a using a Raspberry Pi and that you want to be able kill it reliably, you are probably not worried about database sessions and that sort of thing. So just kill it and check exit status, and you should be good to go. Dave |
Hi Dave,
Thanks for the reply. >Hi Lou, >I think there is some clever shutdown code in #snapshot:andQuitWithExitCode:. >Maybe you care about that, and maybe you don't. And maybe it works reliably >and maybe it does not, I don't know. I'm thinking I don't care about it. >But I do know that if you do "Smalltalk quitPrimitive: 7" it will definitely >exit, and the $? exit code that you see in the shell will be 7. So that may >be all that you need to do. I'm sure I knew this but you pointing it out got me to realize that any time my Squeak program exits it will only be restarted with a reboot of the Raspberry. Given that and that I don't save the image, rebooting should clean up everything to a fresh start, including the GPIO pins. So, I will avoid all the Squeak shutdown code and just exit with the primitive. >Note: The clever shutdown code is probably there to try to do a reasonable >cleanup for a Squeak image that might have open connections to a database session, >or some other resource then should be properly cleaned up before you kill the >Squeak VM process. Given that you a using a Raspberry Pi and that you want to >be able kill it reliably, you are probably not worried about database sessions >and that sort of thing. So just kill it and check exit status, and you should >be good to go. Agreed. >Dave Thanks again, Dave. Lou -- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon |
Free forum by Nabble | Edit this page |