Credentials input not working with contex.run from within a Devcontainer
还没有人认领这个 Issue。
评估
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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)
- 主要语言
- Python
- 星标
- 4.8k
- 派生
- 414
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pyinvoke/invoke 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 64/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
NousResearch/hermes-plugin-claude-subscription-directsdk#94 ·
维护者通常 1 天内回复
-
namespace operations
难度 2/5 1-3 小时 新手友好度 72/100
EclipseFdn/open-vsx.org#13702 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
modelscope/ms-swift#10287 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
modelscope/FunASR#3757 ·
维护者通常 1 天内回复