From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Karr Newsgroups: gmane.emacs.help Subject: Re: How to avoid having shell scripts which fail from killing Emacs shell? Date: Tue, 23 Jun 2009 08:06:31 -0700 (PDT) Organization: http://groups.google.com Message-ID: <40c8cb64-0eda-40d5-8d5a-547074c692de@q3g2000pra.googlegroups.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 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1245775194 1520 80.91.229.12 (23 Jun 2009 16:39:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Jun 2009 16:39:54 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 23 18:39:47 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 1MJ929-0007VD-En for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jun 2009 18:39:45 +0200 Original-Received: from localhost ([127.0.0.1]:38253 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MJ928-0003s4-Tm for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jun 2009 12:39:44 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!postnews.google.com!q3g2000pra.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 55 Original-NNTP-Posting-Host: 207.188.29.244 Original-X-Trace: posting.google.com 1245769592 3673 127.0.0.1 (23 Jun 2009 15:06:32 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 23 Jun 2009 15:06:32 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: q3g2000pra.googlegroups.com; posting-host=207.188.29.244; posting-account=78dYpQkAAABkXq5R--mk7bpN1x43kmXK User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729), gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:170237 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:65456 Archived-At: On Jun 23, 6:15=A0am, "David M. Karr" wrote: > 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 = =A0 > >>>> killed when a script it's running fails. > >>> Make the shell script trap (shell built-in) this catastrophic error = =A0 > >>> and just execute an exit (shell built-in) instead (in last millennium= =A0 > >>> this was standard). You can also run shell scripts asynchronously in = =A0 > >>> a dedicated temporary buffer by executing it as a shell or compile = =A0 > >>> 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). =A0To do so, you must put: > > > #!/bin/bash > > That's not the problem. =A0It'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. =A0I 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. =A0However, when I then chang= e > the class to read a line from stdin, whether it throws an exception or > not, the shell dies after the script completes. =A0I imagine I could > simplify this test case by just doing the readline from the script, > instead of the class. =A0I'll try that a little later this morning. I didn't get a chance to run a test on Unix/Linux, but I tried changing my script to just do a "read" with a prompt. When I run this, it does not kill the shell at the end of the script. When I change it back to do the same thing from Java, it kills the shell at the end of the script. Very odd. Note that I'm specifically stating "at the end of the script". If I put a print statement in the script after the call to Java, it prints the line, finishes the script, then kills the shell.