MCPcopy Create free account
hub / github.com/aws/aws-cli / compat_input

Function compat_input

awscli/compat.py:250–272  ·  view source on GitHub ↗

Cygwin's pty's are based on pipes. Therefore, when it interacts with a Win32 program (such as Win32 python), what that program sees is a pipe instead of a console. This is important because python buffers pipes, and so on a pty-based terminal, text will not necessarily appear immedi

(prompt)

Source from the content-addressed store, hash-verified

248
249
250def compat_input(prompt):
251 """
252 Cygwin's pty's are based on pipes. Therefore, when it interacts with a Win32
253 program (such as Win32 python), what that program sees is a pipe instead of
254 a console. This is important because python buffers pipes, and so on a
255 pty-based terminal, text will not necessarily appear immediately. In most
256 cases, this isn't a big deal. But when we're doing an interactive prompt,
257 the result is that the prompts won't display until we fill the buffer. Since
258 raw_input does not flush the prompt, we need to manually write and flush it.
259
260 See https://github.com/mintty/mintty/issues/56 for more details.
261 """
262 sys.stdout.write(prompt)
263 sys.stdout.flush()
264 try:
265 # This is unused directly when the user pastes the cross-device
266 # verification code, which may be longer than some terminal's buffers
267 import readline # noqa: F401
268
269 return raw_input()
270 except ImportError:
271 LOG.debug('readline module not available')
272 return raw_input()
273
274
275def compat_shell_quote(s, platform=None, shell=False):

Callers 5

yes_no_choiceFunction · 0.90
_promptMethod · 0.90
get_valueMethod · 0.90
get_valueMethod · 0.90
get_credential_valueMethod · 0.90

Calls 2

writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected