X-Spam-Check-By: sourceware.org Message-ID: <4545F1F9.E59A35FC@dessent.net> Date: Mon, 30 Oct 2006 04:37:13 -0800 From: Brian Dessent X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) MIME-Version: 1.0 To: fergus CC: cygwin AT cygwin DOT com Subject: Re: Old favourite: Terminate batch job (Y/N)? References: <000001c6fc1a$a78b95d0$d60210ac AT tcgp DOT dundee DOT ac DOT uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 fergus wrote: > If during the bash session I issue ctrl-C to interrupt something, then on > exiting bash the ctrl-C instruction seems to have been queued for use and I > am invited to "Terminate batch job (Y/N)?" before commencing the sequence at > {commandlist 2}. It's not that ^C got queued up, it's that cmd.exe prompts you thusly any time a process launched in a batch file returns with a non-zero exit code. Further, bash's exit status is the same as the last executed command, thus if you run a command that exited with non-zero status (such as one that was killed) and then hit ^D or type exit to close bash, then cmd.exe will see that non-zero error from the command and prompt you. > However, I find that if I do this, then on starting bash, all the > instructions issued in the preceding {sequence of "mount" intructions} are > ignored in the new bash process. (But they were carried out correctly, as > was confirmed; and the consequences of the instructions issued in > {commandlist 1} are remembered. So it's not that all the contents of the > .cmd file preceding the start bash command are, for whatever reason, > ignored. Just some of them!) Cygwin's 'mount' command and the mount table itself are stored in the registry, so the actions of one process should be seen in another. I think what you are actually seeing is the fact that when you use 'start' it asynchronously starts the new process and does not wait for it to terminate before continuing in the batch file, so that your {commandlist 2} gets executed immediately, not when bash exits. This is a WAG but if your {commandlist 2} contains unmount commands then it would certainly appear in the bash session as though the mount commands had never happened, since they will have been unmounted by the time you get to do anything in bash. If you change it to "start /wait bash" then you should get the desired behavior of waiting for the bash process to terminate before continuing in the batch file. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/