From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "David M. Karr" Newsgroups: gmane.emacs.help Subject: Re: How to avoid having shell scripts which fail from killing Emacs shell? Date: Tue, 23 Jun 2009 06:15:33 -0700 Message-ID: <4A40D575.6010703@gmail.com> References: <88ba12ed-8f02-4f3e-bb30-cc6155a38df2@f38g2000pra.googlegroups.com> <533b7087-5aa6-4278-b995-6a2166e7494e@c18g2000prh.googlegroups.com> <7cr5xbpbxz.fsf@pbourguignon.anevia.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1245763756 25577 80.91.229.12 (23 Jun 2009 13:29:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Jun 2009 13:29:16 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "Pascal J. Bourguignon" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 23 15:29:12 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MJ63g-0002uj-22 for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jun 2009 15:29:08 +0200 Original-Received: from localhost ([127.0.0.1]:53945 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MJ63f-0000ab-F0 for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jun 2009 09:29:07 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MJ5qi-0001Zf-HH for help-gnu-emacs@gnu.org; Tue, 23 Jun 2009 09:15:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MJ5qc-0001Oa-5M for help-gnu-emacs@gnu.org; Tue, 23 Jun 2009 09:15:42 -0400 Original-Received: from [199.232.76.173] (port=43166 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MJ5qb-0001OF-Gl for help-gnu-emacs@gnu.org; Tue, 23 Jun 2009 09:15:37 -0400 Original-Received: from rv-out-0708.google.com ([209.85.198.245]:62112) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MJ5qb-0005NC-3j for help-gnu-emacs@gnu.org; Tue, 23 Jun 2009 09:15:37 -0400 Original-Received: by rv-out-0708.google.com with SMTP id k29so24261rvb.6 for ; Tue, 23 Jun 2009 06:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=bV6BjIBppAV3pfN0gmcP8BiAtc8rWKYglhk5qq8mQs0=; b=DGhGHDr4vDvSG5VBbQYuIYjaBCkOBZrujKa8FbVK+ou4IZHGDEeJn8oVGPRtvcVEqG g/H4VkaUM1DH5w/mKLOT+/u0jEEpRmzrLjZTXjwNVWO+SImsXXH+8UljxovTIKKwCNsL GLjv5q6Yv3XpS9btgScYz7rnzitzTYSBN8SOk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=fMR6Xh2U+cMwHsej5p/rUmiRan0WKvKooi18piSFbwjiRXLoSa/9m2uspXK/9MidxK GrlZ/H6bCPBGhq6nBVAqcY8ySiCwWf9roJvbCkfSjhp8PFlr5MbHoURSc5JerBJ0NkYO 3FWuflBZt7lI8vbWrX10PmDTTYoUoyhrqzpEM= Original-Received: by 10.140.125.1 with SMTP id x1mr99415rvc.14.1245762935443; Tue, 23 Jun 2009 06:15:35 -0700 (PDT) Original-Received: from ?192.168.1.100? (pool-71-117-2-173.sttlwa.btas.verizon.net [71.117.2.173]) by mx.google.com with ESMTPS id b39sm2800402rvf.0.2009.06.23.06.15.32 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 23 Jun 2009 06:15:33 -0700 (PDT) User-Agent: Thunderbird 2.0.0.21 (X11/20090318) In-Reply-To: <7cr5xbpbxz.fsf@pbourguignon.anevia.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:65447 Archived-At: Pascal J. Bourguignon wrote: > David Karr writes: > >> On Jun 20, 2:06 am, Peter Dyballa wrote: >>> Am 20.06.2009 um 01:03 schrieb David Karr: >>> >>>> to configure Emacs or the Bash inside Emacs, so that it doesn't get >>>> killed when a script it's running fails. >>> Make the shell script trap (shell built-in) this catastrophic error >>> and just execute an exit (shell built-in) instead (in last millennium >>> this was standard). You can also run shell scripts asynchronously in >>> a dedicated temporary buffer by executing it as a shell or compile >>> command. >> If it matters, changing my test script to use "trap" to just exit on a >> signal didn't make any difference. > > Probably your "script" is not a script but a text file containing > shell commands that you source. > > The trick to avoid having it kill your shell, is to have it run in its > own shell (which it is free to kill). To do so, you must put: > > #!/bin/bash That's not the problem. It's a proper script and executable. I've managed to find an element of this that seems to cause the problem, and removing that component makes it not happen. Currently, my test class also reads a line of input from stdin, in addition to some command-line arguments. I tried creating a dummy test class that doesn't read from stdin, even when I force it to throw an exception, and that doesn't kill the shell. However, when I then change the class to read a line from stdin, whether it throws an exception or not, the shell dies after the script completes. I imagine I could simplify this test case by just doing the readline from the script, instead of the class. I'll try that a little later this morning.