This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Old favourite: Terminate batch job (Y/N)?


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]