Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Keene <seraphire@gmail.com>2020-02-11 21:57:58 +0300
committerJunio C Hamano <gitster@pobox.com>2020-02-11 23:04:05 +0300
commit6b602a2f97bbf27c8858643efeabce23195414cb (patch)
treef766946e9dbc9f1f68b35a51a525fc0b53c55be1 /git-p4.py
parentd0654dc308b0ba76dd8ed7bbb33c8d8f7aacd783 (diff)
git-p4: rewrite prompt to be Windows compatible
The existing function prompt(prompt_text) does not work correctly when run on Windows 10 bash terminal when launched from the sourcetree GUI application. The stdout is not flushed properly so the prompt text is not displayed to the user until the next flush of stdout, which is quite confusing. Change this method by: * Adding flush to stderr, stdout, and stdin * Use readline from sys.stdin instead of raw_input. The existing strip().lower() are retained. Signed-off-by: Ben Keene <seraphire@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/git-p4.py b/git-p4.py
index 40d9e7c594..65b6d4dca0 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -175,7 +175,10 @@ def prompt(prompt_text):
"""
choices = set(m.group(1) for m in re.finditer(r"\[(.)\]", prompt_text))
while True:
- response = raw_input(prompt_text).strip().lower()
+ sys.stderr.flush()
+ sys.stdout.write(prompt_text)
+ sys.stdout.flush()
+ response=sys.stdin.readline().strip().lower()
if not response:
continue
response = response[0]