Command prompt hangs until keypress?

40

20

Problem:

For some reason once in a while my command prompt would hang until I press a random key, and it would continue operation as if nothing happened.

Occurrence:

This happens when I am running a long operation (such as building/compiling some code). When it hangs, it gives no indication of what's going on nor does it prompt me to press any key.

Description:

  1. After a couple minutes, the terminal stops printing out the progress, and gets stuck.
  2. I had thought that it was simply stuck on a very lengthy portion of the compile process, but after a few hours it was still stuck on the exact same place.
  3. I pressed a random key, and it suddenly jumped straight back and continued spewing out progress indicators and continued working.

After this, similar events have happened many times during lengthy processes, such as copying files.

This has happened on multiple devices running windows 7. It has also occurred on ubuntu using bash shell.

Razor Storm

Posted 2011-07-18T22:57:14.783

Reputation: 669

1Those who are wondering if it is still an issue,Yes ! – Thakur Karthik – 2019-12-31T06:52:35.380

2Any of these machines set to sleep at all? – Windos – 2011-07-18T23:04:25.267

No, the machine doesn't go to sleep, just the terminal apparently. The machines also don't have sleep or any low power modes enabled. And have never once gone into sleep mode in their entire life time (Since I bought/built them) – Razor Storm – 2011-07-18T23:46:54.917

It sounds like you're having the same issue from two completely different environments (Linux and Windows). So you might ask what do these two things have in common? Is it the same script/code? Copying to the same server? – Nixphoe – 2011-07-19T01:54:49.603

This has happened many times over several years on completely different tasks. Some things Ive done that I remember: making a build at work, copying some files locally (robocopy on windows and cp on linux), rsync on remote servers, running batch scripts, etc – Razor Storm – 2011-07-19T04:45:16.713

Answers

28

I have experienced the same issue. Answers here and here indicate this is likely an issue with Quick Edit mode in the console. If it intercepts stray mouse clicks, or if clicks get passed erroneously through RDP, for instance, it can unintentionally pause the script. You can right-click the menubar and edit properties to turn off Quick Edit mode. That, of course, makes it more difficult to copy and paste out of the CMD window.

Tim D

Posted 2011-07-18T22:57:14.783

Reputation: 389

I have quick edit mode off, and experience this often in node. No issues on linux. But windows will seem to pause, until I ctr C once. This continues the node process. Seems like it would kill the process if it was truly hanging. – edencorbin – 2018-09-05T23:14:28.793

I have disabled quick edit mode so will keep an eye. My solution is to resize my cmd prompt, or power shell window a bit - to get the npm script to continue. Very strange indeed. – shanehoban – 2019-02-28T23:07:25.880

2I've seen this for 20 years in windows. It has appeared and disappeared many times... I think its Microsoft not doing proper regression testing, because it comes and goes every few years – gunslingor – 2019-10-11T16:38:45.113

Experiencing this regularly these days when running python3.7 scripts in powershell, very annoying :( – Loknar – 2019-12-18T12:22:30.170