implement blocking IO from stdin