unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* atexit function
@ 2006-09-15 14:03 Marco Maggi
  2006-09-16  0:32 ` Kevin Ryde
  2006-09-18  0:44 ` Jon Wilson
  0 siblings, 2 replies; 4+ messages in thread
From: Marco Maggi @ 2006-09-15 14:03 UTC (permalink / raw)


Is it possible to have an ATEXIT function? That is:
an interface to register thunks that are executed
when the script exits.

It would be useful for my test suite module, with
which test scripts are just top level invocation
to functions, without initialisation and finalisation.


--
Marco Maggi

"They say jump!, you say how high?"
Rage Against the Machine - "Bullet in the Head"



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: atexit function
  2006-09-15 14:03 atexit function Marco Maggi
@ 2006-09-16  0:32 ` Kevin Ryde
  2006-09-18  0:44 ` Jon Wilson
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Ryde @ 2006-09-16  0:32 UTC (permalink / raw)
  Cc: guile-user

"Marco Maggi" <marco.maggi-ipsu@poste.it> writes:
>
> Is it possible to have an ATEXIT function? That is:
> an interface to register thunks that are executed
> when the script exits.

I've been using this:

	(define-public (c-atexit proc)
	  (let ((old-exit exit))
	    (set! exit (lambda args
	                 (proc)
	                 (apply old-exit args)))))

to hang code on the exit func.  Unfortunately the normal "guile -s" to
run a script doesn't go via that function, so it only works if you
explicitly "(exit 0)".


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: atexit function
  2006-09-15 14:03 atexit function Marco Maggi
  2006-09-16  0:32 ` Kevin Ryde
@ 2006-09-18  0:44 ` Jon Wilson
  1 sibling, 0 replies; 4+ messages in thread
From: Jon Wilson @ 2006-09-18  0:44 UTC (permalink / raw)
  Cc: guile-user

Hi Marco,
I wonder if it is possible to use an async for this?  I've never used 
asyncs, so I'm not sure of their capabilities, but it seems like that would 
be the natural way to implement something like this.
Regards,
Jon

Marco Maggi wrote:
> Is it possible to have an ATEXIT function? That is:
> an interface to register thunks that are executed
> when the script exits.
> 
> It would be useful for my test suite module, with
> which test scripts are just top level invocation
> to functions, without initialisation and finalisation.
> 
> 


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: atexit function
@ 2006-09-18  6:46 Marco Maggi
  0 siblings, 0 replies; 4+ messages in thread
From: Marco Maggi @ 2006-09-18  6:46 UTC (permalink / raw)


No luck so far. The EXIT-HOOK is executed only if
RUN-HOOK is invoked and in my experiments this does
not happen with 'guile -s' or EXIT invocation.

I am thinking of patching guile for a special
EXIT signal, to make it work like the GNU Bash
fake EXIT signal.

--
Marco Maggi

"They say jump!, you say how high?"
Rage Against the Machine - "Bullet in the Head"



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-09-18  6:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-15 14:03 atexit function Marco Maggi
2006-09-16  0:32 ` Kevin Ryde
2006-09-18  0:44 ` Jon Wilson
  -- strict thread matches above, loose matches on Subject: below --
2006-09-18  6:46 Marco Maggi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).