From: Taylor Venable <taylor@metasyntax.net>
To: guile-user@gnu.org
Subject: Jumping back to REPL prompt on ^C
Date: Sun, 20 Jun 2010 19:15:56 -0400 [thread overview]
Message-ID: <AANLkTilwUoHrUxZyDH7rQAH-Bq1K6yzvpyVt8QB6B4Rj@mail.gmail.com> (raw)
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/
next reply other threads:[~2010-06-20 23:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-20 23:15 Taylor Venable [this message]
2010-07-04 20:52 ` Jumping back to REPL prompt on ^C Neil Jerram
2010-07-08 19:31 ` Andy Wingo
2010-07-09 15:57 ` Andy Wingo
2010-07-27 21:16 ` Taylor Venable
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTilwUoHrUxZyDH7rQAH-Bq1K6yzvpyVt8QB6B4Rj@mail.gmail.com \
--to=taylor@metasyntax.net \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).