unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Jumping back to REPL prompt on ^C
@ 2010-06-20 23:15 Taylor Venable
  2010-07-04 20:52 ` Neil Jerram
  0 siblings, 1 reply; 5+ messages in thread
From: Taylor Venable @ 2010-06-20 23:15 UTC (permalink / raw)
  To: guile-user

Hi there, I'm writing a piece of code with a web server component, and
part of that being that I want to jump back to the REPL when one hits
^C.  So it would go something like this:

scheme@(guile-user)> (start-server)
;;; handling requests
^C
scheme@(guile-user)>

What I tried doing was essentially this:

(call/cc (lambda (k) (sigaction SIGINT (lambda (_) (k))) (start-server)))

Except *sometimes* when I hit ^C I ended up with an error that stops
the guile program completely, seemingly due to the readline library
that I've enabled in the REPL.  When I simplify my test I'm able to
get the same fatal error all the time.

scheme@(guile-user)> (call/cc (lambda (k) (sigaction SIGINT (lambda (_) (k)))))
(#<procedure 1e04720 at ice-9/boot-9.scm:3422:34 (sig)> . 67108864)
scheme@(guile-user)> Backtrace:
In ice-9/boot-9.scm:
 170: 12 [catch #t #<catch-closure 1ad8900> ...]
In unknown file:
   ?: 11 [catch-closure]
In ice-9/boot-9.scm:
  62: 10 [call-with-prompt prompt0 ...]
3437: 9 [top-repl]
In system/repl/repl.scm:
 105: 8 [start-repl scheme #:level 0 #:welcome #t]
 110: 7 [next-char #f]
In unknown file:
   ?: 6 [peek-char #<undefined>]
In ice-9/buffered-input.scm:
  72: 5 [get-character]
 107: 4 [#<procedure 1ee1100 at ice-9/buffered-input.scm:105:28
(continuation?)> #f]
In ice-9/eval.scm:
 374: 3 [eval # #]
In unknown file:
   ?: 2 [%readline "" #<input: standard input /dev/pts/2> ...]
In ice-9/boot-9.scm:
 115: 1 [#<procedure 1c4eca8 at ice-9/boot-9.scm:109:6 (thrown-k .
args)> misc-error ...]
In unknown file:
   ?: 0 [catch-closure misc-error "%readline" "readline is not reentrant" () #f]

ERROR: In procedure %readline:
ERROR: readline is not reentrant

After the error my terminal is left without key echoing enabled.  Is
there a way to accomplish what I'm trying to do?  Perhaps I simply
cannot do this with readline support enabled?  I'm not quite skilled
enough to figure out if my method is even a sensible way to try to get
it, or maybe I've violated something important by trying to invoke the
current continuation at the REPL.  I'm using Guile 2.0 from git,
commit 8d10ccae79ff46f0ebea92ba36acfaebafba8d86 on Linux x86_64.

Thanks for any ideas or explanation,

-- 
Taylor C. Venable
http://metasyntax.net/



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

end of thread, other threads:[~2010-07-27 21:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-20 23:15 Jumping back to REPL prompt on ^C Taylor Venable
2010-07-04 20:52 ` Neil Jerram
2010-07-08 19:31   ` Andy Wingo
2010-07-09 15:57     ` Andy Wingo
2010-07-27 21:16       ` Taylor Venable

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).