With the following command you can register some callback for stdin:
fileevent stdin readable thatCallback
This means that during the execution of the update command it will evaluate thatCallback time after time while there is input available at stdin.
How can I check if input is available at stdin ?