flush stdin before asking for input

Same as ros-infrastructure/bloom#249.

@wjwwood Please review.
Actually shouldn't this line be:

    tcflush(sys.stdin, TCIFLUSH)