Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flush stdin before asking for input #658

Merged
merged 1 commit into from
Jun 16, 2014
Merged

Conversation

dirk-thomas
Copy link
Member

Same as ros-infrastructure/bloom#249.

@wjwwood Please review.

@wjwwood
Copy link
Member

wjwwood commented Jun 15, 2014

So I noticed in bloom that sometimes the messages which are printed to stdout before one of these prompts never gets displayed. I'm not sure I can reproduce it, but it has definitely happened.

@dirk-thomas
Copy link
Member Author

But do you think it is related to the stdin flushing?

@wjwwood
Copy link
Member

wjwwood commented Jun 16, 2014

I do actually, this is an example of what I am talking about:

==> Generating pull request to distro file located at 'https://raw.github.com/ros/rosdistro/master/hydro/distribution.yaml'
Would you like to add source information for this repository? [Y/n]? n
Would you like to add a maintenance status for this repository? [Y/n]?
Please enter a maintenance status.
Valid maintenance statuses:
- developed: active development is in progress
Status:

There should be two other - prefixed options before the Status: line.

Maybe we should flush stdout before truncating the stdin? I can try that locally and see if that make a difference.

def _flush_stdin():
try:
from termios import tcflush, TCIOFLUSH
tcflush(sys.stdin, TCIOFLUSH)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually shouldn't this line be:

tcflush(sys.stdin, TCIFLUSH)

@dirk-thomas
Copy link
Member Author

@wjwwood Can you please give it a try with my previous comment on changing TCIOFLUSH to TCIFLUSH?

@wjwwood
Copy link
Member

wjwwood commented Jun 16, 2014

I'll give it a try now.

@wjwwood
Copy link
Member

wjwwood commented Jun 16, 2014

+1

dirk-thomas added a commit that referenced this pull request Jun 16, 2014
flush stdin before asking for input
@dirk-thomas dirk-thomas merged commit a01a2d7 into indigo-devel Jun 16, 2014
@dirk-thomas dirk-thomas deleted the flush_stdin branch June 16, 2014 18:07
cwecht pushed a commit to cwecht/catkin that referenced this pull request Mar 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants