powershell bash loops are randomly stuck waiting for keyboard input

bash, input, loops, powershell, wait

Solution

I have encountered the same problem several times. Now I guess I have found the reason!

If you ever press the mouse within the powershell, it might get stuck and need user to press "enter" to continue. So the get-around-way is to make sure that you didn't accidentally press your mouse within the shell window while you are already running some program...

Problem

I have bash script I am running from powershell in windows that does a `for` loop. Every once in a while, one of the loop iteration hangs until I hit enter on the keyboard. This doesn't happen all the time, in fact, it happens pretty rarely, but it still does. The interesting thing is that my loop innards is basically `time _command_` and so after I hit enter, it'll tell me how long the command took to run. The command actually takes way less time to execute than the loop iteration takes - because it's waiting for keyboard input for some odd reason. It's pretty annoying to leave a script running overnight and come back in the morning to see that it didn't get very far. Does someone knows WHY this happens and WHAT to do to get around it? Thanks, jbu

Original source