From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user Subject: Re: Jumping back to REPL prompt on ^C Date: Thu, 08 Jul 2010 20:31:43 +0100 Message-ID: References: <87vd8vq8ak.fsf@ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1278682592 11350 80.91.229.12 (9 Jul 2010 13:36:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 9 Jul 2010 13:36:32 +0000 (UTC) Cc: guile-user@gnu.org To: Neil Jerram Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Jul 09 15:36:30 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 1OXDke-00087B-E8 for guile-user@m.gmane.org; Fri, 09 Jul 2010 15:36:24 +0200 Original-Received: from localhost ([127.0.0.1]:48730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OXDkd-00014b-Og for guile-user@m.gmane.org; Fri, 09 Jul 2010 09:36:23 -0400 Original-Received: from [140.186.70.92] (port=36352 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OXDjr-0000iL-H6 for guile-user@gnu.org; Fri, 09 Jul 2010 09:35:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OXDjp-0007tP-Sk for guile-user@gnu.org; Fri, 09 Jul 2010 09:35:35 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:42894 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OXDjp-0007nb-Qw for guile-user@gnu.org; Fri, 09 Jul 2010 09:35:33 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id E4679C24ED; Fri, 9 Jul 2010 09:34:59 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=J7RWOmelb81qmW2XKpf++rLnrtw=; b=fyfKM9 N4e41RBUBt8U3dtS5l+rCIosP8HEWB5agHacQf0Dkw65d3ZV/RcHlkFFzdLVERNV N9LntgtAGL+E0R2RhMx2KgRYGlZkfPgaecbkx6/pzAWXYvM6aCCQwWLP1B2yADgy XN2qPNgD8fMMNqMzZl8V9ColweD2Lm1vyiyM0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=tw+di5Q7MzQBShHsTcea/rZiCe3MrkT5 qgJdiLqV466Xb0e3cIl1C/gGjhu99qeY4cUZBLcgxi57raxFcF8a4lgFjQBnT5RM tlPMsNxUh2EWDyKSD1QvbzrGkAPzHgHjSbDBarAX//z2YVfNB3eivoLiXbqbC4Po Lt2RqcoelBw= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id AB032C24EC; Fri, 9 Jul 2010 09:34:57 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [81.39.161.70]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 8C874C24EA; Fri, 9 Jul 2010 09:34:54 -0400 (EDT) In-Reply-To: <87vd8vq8ak.fsf@ossau.uklinux.net> (Neil Jerram's message of "Sun, 04 Jul 2010 21:52:19 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: C40C4EAC-8B5E-11DF-A997-9056EE7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) 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:7977 Archived-At: Hi Neil & Taylor, On Sun 04 Jul 2010 21:52, Neil Jerram writes: > Taylor Venable writes: > >> 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))) > > Just a couple of notes here. > > First, continuations usually take an argument: the value which will be > the return value of the (call/cc ...) expression. So '(k)' may be > wrong. Indeed, though the intention may be that an escape returns 0 values; unlikely however. > Second, I wonder if you meant (lambda _ ...) instead of (lambda (_) > ...). I often use the former when I want a lambda that accepts any > number of arguments. True, though sigaction handlers do get called with only one argument. >> 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. > [..] >> In unknown file: >> ?: 0 [catch-closure misc-error "%readline" "readline is not reentrant" () #f] You know, I've seen this on a couple occaisions. If you can find out how to reproduce this I would be very interested. In the future you should be able to just return to the prompt on SIGINT by setting a REPL option. Dunno if that works for Taylor, though... Andy -- http://wingolog.org/