Skip to content

Commit 9e2c5b2

Browse files
committed
echo input() prompt and user-inputted text to stdout
1 parent 243ed70 commit 9e2c5b2

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎v3/pg_logger.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,13 @@ class RawInputException(Exception):
180180

181181
def raw_input_wrapper(prompt=''):
182182
if input_string_queue:
183-
return input_string_queue.pop(0)
183+
input_str = input_string_queue.pop(0)
184+
185+
# write the prompt and user input to stdout, to emulate what happens
186+
# at the terminal
187+
sys.stdout.write(prompt)
188+
sys.stdout.write(input_str + "\n") # newline to simulate the user hitting Enter
189+
return input_str
184190
raise RawInputException(prompt)
185191

186192
class MouseInputException(Exception):

0 commit comments

Comments
 (0)