Why Windows shell (cmd.exe) tends to hang until a key is pressed? [duplicate]

Why would a program that is run from the command line wait for user input (pressing Enter) if it wasn't programmed to do so?

I was using an AWS EC2 instance to run a computationally intensive program that does a few things including reading files, running computations on file contents and creating new files. For each of the tasks the program printed some debug info to stdout.

After going through a couple of steps it seemingly got stuck on a massive computation. The program hadn't advanced for too long and the resource use had dropped from the steady level when starting the step so I hit Enter out of frustration and it immediately proceeded.

  • I wasn't prompted for input
  • The author reassured me that an input pause wasn't in the source code
  • Given the facts a coincidence is very unlikely

Is this a system bug / quirk / feature?

Why could it happen and can I avoid this in the future?


Solution 1:

Windows command prompt (cmd.exe) has a "quick edit" mode which is enabled by default.

Quick Edit Mode

With "quick edit" mode enabled, if you click on the command prompt while it is updating, E.g. in the case of running a command such as:

ping www.google.com -t

then updating the output will stop until a key is entered such as Enter in the case of the question.