Squeak --headless and SIGTERM

David T. Lewis lewis at mail.msen.com
Sat Mar 12 17:49:30 UTC 2005


On Sat, Mar 12, 2005 at 07:14:14PM +0200, Brent Pinkney wrote:
> Hi,
> 
> I have a Smallwiki image rnning headless.
> 
> I stop this image using: kill <pid> which Ipresume sends a SIGKILL signal  
> to the image.
> 
> Is there a way the image can trap a signal and execute some Smalltalk  
> code, like saving the image ?

Well, you cannot catch a SIGKILL, but if you want to catch SIGTERM (the
that gets sent by "kill <pid>", here is how to do it:


  [ | sigKillSema |
  sigKillSema := OSProcess accessor forwardSigTerm.
  [sigKillSema wait.
  Transcript show: 'just caught a SIGTERM signal'; cr] repeat]
      fork name: 'SIGTERM watcher process'


Dave




More information about the Squeak-dev mailing list