all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Karr <davidmichaelkarr@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to avoid having shell scripts which fail from killing Emacs shell?
Date: Tue, 23 Jun 2009 08:06:31 -0700 (PDT)	[thread overview]
Message-ID: <40c8cb64-0eda-40d5-8d5a-547074c692de@q3g2000pra.googlegroups.com> (raw)
In-Reply-To: mailman.1141.1245762947.2239.help-gnu-emacs@gnu.org

On Jun 23, 6:15 am, "David M. Karr" <davidmichaelk...@gmail.com>
wrote:
> Pascal J. Bourguignon wrote:
> > David Karr <davidmichaelk...@gmail.com> writes:
>
> >> On Jun 20, 2:06 am, Peter Dyballa <Peter_Dyba...@Web.DE> 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.

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.


  parent reply	other threads:[~2009-06-23 15:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-19 23:03 How to avoid having shell scripts which fail from killing Emacs shell? David Karr
2009-06-19 23:06 ` David Karr
2009-07-10  2:21   ` David Combs
2009-06-20  9:06 ` Peter Dyballa
     [not found] ` <mailman.987.1245488796.2239.help-gnu-emacs@gnu.org>
2009-06-22 16:43   ` David Karr
2009-06-22 18:47     ` Peter Dyballa
2009-06-23  8:54     ` Pascal J. Bourguignon
2009-06-23 13:15       ` David M. Karr
2009-06-23 15:56         ` Peter Dyballa
     [not found]       ` <mailman.1141.1245762947.2239.help-gnu-emacs@gnu.org>
2009-06-23 15:06         ` David Karr [this message]
2009-06-23 17:26           ` Peter Dyballa
2009-06-22 20:21 ` David Karr
2009-06-22 22:49   ` Peter Dyballa
     [not found]   ` <mailman.1102.1245710994.2239.help-gnu-emacs@gnu.org>
2009-06-22 23:08     ` David Karr
2009-06-22 23:38     ` David Karr

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40c8cb64-0eda-40d5-8d5a-547074c692de@q3g2000pra.googlegroups.com \
    --to=davidmichaelkarr@gmail.com \
    --cc=help-gnu-emacs@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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.