From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Taylor Venable Newsgroups: gmane.lisp.guile.user Subject: Jumping back to REPL prompt on ^C Date: Sun, 20 Jun 2010 19:15:56 -0400 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1277075776 24055 80.91.229.12 (20 Jun 2010 23:16:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 20 Jun 2010 23:16:16 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Jun 21 01:16:14 2010 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OQTkF-0004vS-Ol for guile-user@m.gmane.org; Mon, 21 Jun 2010 01:16:08 +0200 Original-Received: from localhost ([127.0.0.1]:35805 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQTkF-00022r-5E for guile-user@m.gmane.org; Sun, 20 Jun 2010 19:16:07 -0400 Original-Received: from [140.186.70.92] (port=56162 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQTk7-00020x-F3 for guile-user@gnu.org; Sun, 20 Jun 2010 19:16:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OQTk6-0004XX-7g for guile-user@gnu.org; Sun, 20 Jun 2010 19:15:59 -0400 Original-Received: from mail-iw0-f169.google.com ([209.85.214.169]:63871) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQTk6-0004XL-4m for guile-user@gnu.org; Sun, 20 Jun 2010 19:15:58 -0400 Original-Received: by iwn39 with SMTP id 39so1087759iwn.0 for ; Sun, 20 Jun 2010 16:15:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=vjBtMkplUxCRfPh2PbCoshPpuhmeST5peZCFypaMAhs=; b=n9V8ccgbKhlhh70mWJWRjYBDYDlkdAB5hml8Tp2pPMqCq/8FUVC5xvn5Src/kIEbub iamttdct/1Bm9BuLMU7Kjdxts4f8CAHbgcNnZ8GJVyFXzKB2Wf6k29LuWvcbCpXsduLs laQUo1/MLD4dwnRsl2Mcu5Y8tCGscS+f+j5aA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=D2YJ+iJ7MyYlW1/9SbIDajAf8l15SGN6sDf+8FTgcDi6cUpu6i0WUcvqoTFWaGI6Dz G+fxCOoM3a1fQXDmwrBjAd7U9hntnDw63npZSQ7MPC9D1WOmlq63GHY4Nz5cRAfK1adZ 1XwcnuX/DkOJjRpqP2JDETFkVzTjO8Zv1v/dw= Original-Received: by 10.231.188.150 with SMTP id da22mr4871930ibb.191.1277075756493; Sun, 20 Jun 2010 16:15:56 -0700 (PDT) Original-Received: by 10.231.164.210 with HTTP; Sun, 20 Jun 2010 16:15:56 -0700 (PDT) X-Google-Sender-Auth: fiKQW846NtPY96kophJvLRF37Kw X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7913 Archived-At: 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))))) (# . 67108864) scheme@(guile-user)> Backtrace: In ice-9/boot-9.scm: 170: 12 [catch #t # ...] 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 #] In ice-9/buffered-input.scm: 72: 5 [get-character] 107: 4 [# #f] In ice-9/eval.scm: 374: 3 [eval # #] In unknown file: ?: 2 [%readline "" # ...] In ice-9/boot-9.scm: 115: 1 [# 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/