Credentials input not working with contex.run from within a Devcontainer
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Start by running the provided reproduction script inside a VSCode devcontainer, then trace Context.run with in_stream=True and pty=True/False, including the interaction with Python's input() and getpass(). Done means username and password entry work correctly without the first character being swallowed or the password prompt becoming unresponsive.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
While I found several different issues where something related to stdin did or does not work - this one does not seem to be covered, yet:
What happens:
Entering user name/pw from stdin to programm started with c.run does not work. What (mostly) happens:
- First character gets swallowed somehow. Have to press the first character twice. Found some issues about that one. And: Looks ike
in_stream=Falsemakes the first character appear on the first key press. - PW entry not working: When running inside the devcontainer, after pressing enter to confirm the user name, the password prompt is missing, and nothing happens when I press any key.
pty=True/Falsedoes not seem to have an effectin_stream=Falsewill avoid the 'first-character-gets-swallowed` problem, but still not fix the passwort-entry-problem
You should be able to use the following script to reproduce the issue - when executed from within a devcontainer in VSCode:
import shlex
import sys
import textwrap
from invoke import Context
INNER_SCRIPT = textwrap.dedent(
"""
from getpass import getpass
print('=== Please enter your USERNAME ===', flush=True)
username = input()
print('=== Please enter your PASSWORD ===', flush=True)
password = getpass('')
print(f'You entered username: {username}')
print(f'You entered password: {password}')
"""
).strip()
print(">>> running via invoke Context.run(pty=True)")
cmd = f"{shlex.quote(sys.executable)} -c {shlex.quote(INNER_SCRIPT)}"
Context().run(cmd, in_stream=True)
- Ngôn ngữ chính
- Python
- Star
- 4.8k
- Fork
- 412
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của pyinvoke/invoke
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
-
sdist is missing `pytest.ini` Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Tất cả issue của pyinvoke/invoke
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100