Reputation: 16181
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
Upvotes: 4
Views: 2510
Reputation: 555
Goto the powershell properties and unselect 'Quick Edit'/'Insert'
check boxes. If these are selected, the console pauses output and resumes only when an Enter key is pressed ( You can identify this by monitoring the console title bar- it will switch from "Administrator:Windows PowerShell"
to "Select Administrator:Windows Powershell"
Upvotes: 2
Reputation: 71
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...
Upvotes: 7
Reputation: 360693
Until you post the script, there's little we can do to help.
However, in general, one of your commands probably returns a null once in a while as input to stdin of another command which, upon seeing null looks to the terminal as stdin. Or something along those lines.
Upvotes: 0