Search code examples
macossecurityzshmacos-mojaveiterm

OSX ITerm2/ZSH Terminal Application Execution Requires User to Press Enter to Resume


I am having an issue with ITerm2 on OSX Mojave. I have a long-lived python script running in the background and for some reason the OS or ITerm/ZSH keeps pausing the application and a Key Icon appears in the terminal -- which you can only bypass by pressing the return key. This application is going to take roughly 10 hours to finish processing and I can't just sit there and press enter every time the icon appears. Does anyone have an idea of what could be causing this and how to get around it?


Solution

  • Your Python script is prompting for input of some kind. It's impossible to say what hitting return actually does (is input being used simply to pause before continuing, or is it asking for some actual value, but an empty input accepts some hard-coded default), but you can simulate it.

    Instead of running

    python myScript.py &
    

    run

    yes "" | python myScript.py &
    

    yes will provide an infinite stream of empty strings for your script to read each time it tries to read input.