Re: Old favourite: Terminate batch job (Y/N)?
Fergus Daly wrote: > A second solution offered in the archives is > > .. {as before} > set CYGWIN=tty > bash > .. {as before} > > and this certainly seems to work, in that (a) the invitation to > "Terminate .." no longer appears; and (b) the preceding {sequence of > mount instructions} survives in the bash process. > > But several persons offering this solution also provide gloomy but not > very specific warnings that it is or can be dangerous, causing other > behaviours to be altered. Again, can anybody comment on this as a > solution? (It is now months and in some cases years since the original > postings.) Well, all this does is tell Cygwin to always allocate a pty, even if it's possible to use a standard windows console instead. It is the same affect as using rxvt or xterm, or running the command over ssh. Personally, I always use rxvt and never use the Windows console, so in effect this is the equivalent of running with 'tty' set, and the world has not ended. Many people use CYGWIN=tty as there are some programs that will only function respectably when connected to a pty; it gives you a more unix-like environment. The only thing to watch out for is that because ptys are a Cygwin fiction, native windows programs can sometimes be confused by them. Normally this just means their stdout is buffered and you don't see anything until the buffer fills. But if it is expecting interactive input it can also fail in more strange ways. I prefer using Cygwin tools to native ones anyway, so for me this is not a big deal. You can search the archives for keywords "pty rxvt console native" etc. and you should see many, many threads discussing this. In your specific case, it seems silly to enable this option just to bypass the batch file prompting (and I'm not even sure why that works) as it seems like it's an accidental side effect. I would go with "start /wait", assuming that the second console window is acceptable. 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/
Re: Old favourite: Terminate batch job (Y/N)?
>> .. 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. Exactly right. I thought there was somebody standing behind me all this time. Creepy. >> 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. Thank you very much. I'll use this next. A second solution offered in the archives is .. {as before} set CYGWIN=tty bash .. {as before} and this certainly seems to work, in that (a) the invitation to "Terminate .." no longer appears; and (b) the preceding {sequence of mount instructions} survives in the bash process. But several persons offering this solution also provide gloomy but not very specific warnings that it is or can be dangerous, causing other behaviours to be altered. Again, can anybody comment on this as a solution? (It is now months and in some cases years since the original postings.) Thank you. Fergus -- 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/
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/
Old favourite: Terminate batch job (Y/N)?
For compelling reasons I start bash through a .cmd file with contents {commandlist 1} {sequence of "mount" instuctions} :: next line is to confirm that these instructions have been implemented mount bash {commandlist 2} 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}. This is an old problem and there are various solutions offered in the archives to prevent the presentation of this annoying invitation, of which the most useful seems to be to preface the bash command with "start": ie. amend one line in the .cmd file so that it reads {commandlist 1} {sequence of "mount" instructions} :: next line is to confirm that these instructions have been implemented mount start bash {commandlist 2} 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!) Can anybody explain what's going on here? And can anybody offer a mechanism for suppressing the "Terminate batch job? (Y/N)" invitation that is less prone to breaking something else? Thank you. Fergus -- 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/