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

Not properly outputting in MINGW #1925

Closed
stramel opened this issue Apr 19, 2016 · 4 comments · Fixed by #1945
Closed

Not properly outputting in MINGW #1925

stramel opened this issue Apr 19, 2016 · 4 comments · Fixed by #1945
Labels
bug This issue is a bug. windows

Comments

@stramel
Copy link

stramel commented Apr 19, 2016

System: Windows 7 64bit

steps to reproduce:

  1. Open mingw64 (git bash)
  2. Run aws configure
  3. Observe no output
  4. Hit enter 4 times
  5. Observe output

It looks as if AWS CLI is thinking it is outputting text however it actually isn't.

image

@JordonPhillips JordonPhillips added bug This issue is a bug. windows labels Apr 29, 2016
@JordonPhillips
Copy link
Member

Looks like the issue here is that MINGW doesn't refresh until stdout is flushed explicitly, whereas most terminal emulators will opt to display text as soon as possible. This shouldn't be too hard to fix.

@JordonPhillips
Copy link
Member

In the meantime, you should be able to work around the issue by providing the environment variable PYTHONUNBUFFERED=1.

@stramel
Copy link
Author

stramel commented Apr 29, 2016

@JordonPhillips I put in my environment variables PYTHONUNBUFFERED=1 and even tried exporting it export PYTHONUNBUFFERED=1. Checked with echo $PYTHONUNBUFFERED and got output of 1.

Still same issue. Note that my mingw64 was installed via GIT as the Git Bash terminal.

JordonPhillips added a commit to JordonPhillips/aws-cli that referenced this issue Apr 29, 2016
Some terminal emulators (such as mintty) will not write output to the
terminal window until stdout is explicitly flushed. When running `aws
configure` a user would see nothing but a new line. After pressing
'enter' four times, they would then see the output flushed all in a
single line. This makes it very difficult to configure the command.

The solution is to call `flush` after every prompt. Since `raw_input`
does not have an option to do this, we have to prompt and flush
manually. Since we're already accessing stdout directly, it's easier to
write to it directly since print adds some formatting that we don't
want (namely, a newline at the end of the print).

Fixes aws#1925
JordonPhillips added a commit to JordonPhillips/aws-cli that referenced this issue May 2, 2016
Some terminal emulators (such as mintty) will not write output to the
terminal window until stdout is explicitly flushed. When running `aws
configure` a user would see nothing but a new line. After pressing
'enter' four times, they would then see the output flushed all in a
single line. This makes it very difficult to configure the command.

The solution is to call `flush` after every prompt. Since `raw_input`
does not have an option to do this, we have to prompt and flush
manually. Since we're already accessing stdout directly, it's easier to
write to it directly since print adds some formatting that we don't
want (namely, a newline at the end of the print).

Fixes aws#1925
@JordonPhillips
Copy link
Member

@stramel The fix will be out in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants