flush stdin before asking for input

Same as ros-infrastructure/bloom#249.

@wjwwood Please review.