X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Message-ID: <4A40B8C4.4010203@gmx.de> Date: Tue, 23 Jun 2009 13:13:08 +0200 From: Matthias Andree User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: How to avoid having shell scripts which fail from killing Emacs shell? References: <41FCBA4373FF4228897280824F4627CF AT corp DOT real DOT com> <4A3FDACE DOT 3060402 AT cornell DOT edu> <4A3FE157 DOT 9080901 AT cornell DOT edu> <79EE5DFDC3DC45F2821CD2441A8A63C5 AT corp DOT real DOT com> In-Reply-To: <79EE5DFDC3DC45F2821CD2441A8A63C5@corp.real.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com David Karr schrieb: >> -----Original Message----- >> From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On Behalf >> Of Ken Brown >> Sent: Monday, June 22, 2009 12:54 PM >> To: cygwin AT cygwin DOT com >> Subject: Re: How to avoid having shell scripts which fail from killing >> Emacs shell? >> >> On 6/22/2009 3:38 PM, David Karr wrote: >>>> -----Original Message----- >>>> From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On >> Behalf >>>> Of Ken Brown >>>> Sent: Monday, June 22, 2009 12:26 PM >>>> On 6/22/2009 10:53 AM, David Karr wrote: >>>>> I've often been annoyed by shell scripts which fail for particular >>>>> reasons, at which point it causes my Emacs shell buffer to get killed, >>>>> with "Process shell<2> finished". >>>> I don't recall ever seeing this happen, but maybe I just don't >> remember. >>>> Can you give me a simple test case? >>> I'm not sure how complicated it needs to be. My test case gathers a >> couple >>> of parameters and then calls a Java (JDK 1.6.0_14) class. The class >> throws >>> an exception (file not found) in my test case (because I'm deliberately >>> giving it parameters that will cause that). If I give it parameters >> that >>> will avoid the exception, then it doesn't kill the shell. >>> >>> Is that enough information to build a test case with? >> No. I don't have JDK installed, and I don't have any idea how it >> interacts with cygwin processes. If you can trigger the problem with a >> simple shell script that doesn't require JDK, I'll see if I can help. >> Or maybe someone on the list who does have JDK can suggest something for >> you to try. > > I was able to produce an additional clue by writing a custom class for > testing this. > > I found that the key is whether the Java class reads from stdin or not. I > built a first version that takes a filepath on the command line, and whether > I get the class to throw an exception or not, it exits the script without > killing the shell. However, when I changed the class to also read a line of > input from stdin, whether the filepath on the command line exists or not > (i.e., whether the class throws an exception or not), it kills the shell at > completion of the script. > > So, it has something to do with whether the sub-shell reads stdin or not. I > have no idea what that indicates, but I'm sure that must be useful > information. Just a few pointers: Does the problem go away if the java command is enclosed in parentheses, so as to run it in a sub-shell? Are you using (perhaps in the emacs configuration somewhere) shell options like "-e" for the /outer/ shell? Are you sourcing (". scriptname") rather than executing ("scriptname") your scripts? HTH -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple