RE: How to avoid having shell scripts which fail from killing Emacs shell?
-Original Message- From: cygwin-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.com] On Behalf Of Eric Blake Sent: Tuesday, June 23, 2009 9:04 AM To: cygwin@cygwin.com Subject: Re: How to avoid having shell scripts which fail from killing Emacs shell? David Karr dkarr at real.com writes: 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. I found that the key is whether the Java class reads from stdin or not. I just tried changing my script to instead just do a read with a prompt. This does not kill the shell at the end of the script. When I do it in Java, it kills the shell at the end of the script. Weird. Hmm. JDK is a native windows app, not a cygwin app. So maybe the key here is not just reading stdin, but passing stdin to a non-cygwin app. That seems reasonable. In the past, I believe I've seen references to issues related to I/O interactions with non-cygwin apps. Does that notion give any one else a clue to why this might be happening, or how to mitigate it? -- 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
Re: How to avoid having shell scripts which fail from killing Emacs shell?
David Karr schrieb: -Original Message- From: cygwin-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.com] On Behalf Of Ken Brown Sent: Monday, June 22, 2009 12:54 PM To: cygwin@cygwin.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-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.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 shell2 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
RE: How to avoid having shell scripts which fail from killing Emacs shell?
-Original Message- From: cygwin-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.com] On Behalf Of Matthias Andree Sent: Tuesday, June 23, 2009 4:13 AM To: cygwin@cygwin.com Subject: Re: How to avoid having shell scripts which fail from killing Emacs shell? David Karr schrieb: -Original Message- From: cygwin-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.com] On Behalf Of Ken Brown Sent: Monday, June 22, 2009 12:54 PM To: cygwin@cygwin.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-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.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 shell2 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? No, I tried that earlier. No difference. Are you using (perhaps in the emacs configuration somewhere) shell options like -e for the /outer/ shell? No. Are you sourcing (. scriptname) rather than executing (scriptname) your scripts? No. -- 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
RE: How to avoid having shell scripts which fail from killing Emacs shell?
-Original Message- From: cygwin-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.com] On Behalf Of David Karr Sent: Monday, June 22, 2009 4:42 PM To: kbr...@cornell.edu; cygwin@cygwin.com Subject: RE: How to avoid having shell scripts which fail from killing Emacs shell? -Original Message- From: cygwin-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.com] On Behalf Of Ken Brown Sent: Monday, June 22, 2009 12:54 PM To: cygwin@cygwin.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-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.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 shell2 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. I just tried changing my script to instead just do a read with a prompt. This does not kill the shell at the end of the script. When I do it in Java, it kills the shell at the end of the script. Weird. -- 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
Re: How to avoid having shell scripts which fail from killing Emacs shell?
Am 23.06.2009, 17:03 Uhr, schrieb David Karr dk...@real.com: I just tried changing my script to instead just do a read with a prompt. This does not kill the shell at the end of the script. When I do it in Java, it kills the shell at the end of the script. Weird. Is Java trying anything WRT signalling process groups rather than just itself in the belief it were a session leader, i. e. when it tries to shoot its threads, it accidentally also shoots down the shell? Open stdin descriptors can hamper detaching processes. Does the Java stuff you're doing need stdin? If not, try running the JVM with input redirection such as - (closes stdin, assuming bash or similar) or /dev/null. -- Matthias Andree -- 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
Re: How to avoid having shell scripts which fail from killing Emacs shell?
David Karr dkarr at real.com writes: 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. I found that the key is whether the Java class reads from stdin or not. I just tried changing my script to instead just do a read with a prompt. This does not kill the shell at the end of the script. When I do it in Java, it kills the shell at the end of the script. Weird. Hmm. JDK is a native windows app, not a cygwin app. So maybe the key here is not just reading stdin, but passing stdin to a non-cygwin app. -- Eric Blake -- 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
How to avoid having shell scripts which fail from killing Emacs shell?
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 shell2 finished. I think it's possible to code the scripts to use trap, which might avoid this problem, but sometimes (most times, really) I can't change the script. Is there some way to configure Bash/Cygwin, perhaps in the .emacs_bash script to mitigate this, without significant tradeoffs? -- 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
Re: How to avoid having shell scripts which fail from killing Emacs shell?
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 shell2 finished. I don't recall ever seeing this happen, but maybe I just don't remember. Can you give me a simple test case? Ken -- 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
RE: How to avoid having shell scripts which fail from killing Emacs shell?
-Original Message- From: cygwin-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.com] On Behalf Of Ken Brown Sent: Monday, June 22, 2009 12:26 PM To: cygwin@cygwin.com Subject: Re: How to avoid having shell scripts which fail from killing Emacs shell? 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 shell2 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? -- 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
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-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.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 shell2 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. Ken -- 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
RE: How to avoid having shell scripts which fail from killing Emacs shell?
-Original Message- From: cygwin-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.com] On Behalf Of Ken Brown Sent: Monday, June 22, 2009 12:54 PM To: cygwin@cygwin.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-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.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 shell2 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. -- 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