In the cmd.exe shell the same problem exists.
When I tried to start R again , the same problem is still there, some characters typed are "eaten" and all turn into a mess.
Answer: Use /Rterm.exe instead of ./R.exe to start R instance.
(Google with keyword "R.exe Rterm.exe")
Yes, that is indeed strange behaviour.
Ctrl-C definitely presents problems. For instance, on my WinXP system
running R from a Cygwin prompt, a Ctrl-C during the Sys.sleep kills
Rterm, whereas under the Windows cmd.exe prompt it works properly as
it did for you.
I can guess at an explanation for what you saw, but I don't know how
to fix it:
- R (as opposed to Rterm) is a small .exe program that does a little
argument parsing, then runs Rterm. It looks as though the Ctrl-C is
going to R, and killing that process, but leaving the child process
Rterm running. But since both Rterm and cmd.exe are reading and
writing to standard file handles, you get the messed up prompts.
I've just tried doing what the Windows documentation says should work
(adding this line before Rterm is called:
SetConsoleCtrlHandler(NULL, TRUE); /* Ignore Ctrl-C; Rterm will
handle them */
but this didn't fix the problems, it just made them different (i.e.
Ctrl-C stopped working completely). Rterm *does* set a Ctrl-C
handler, but it just isn't being called, as far as I can tell.
A simple workaround is to run Rterm or Rgui rather than R. If anyone
knows a real fix, please let me know.