Credentials input not working with contex.run from within a Devcontainer

Abierto
#1,069 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
python
Área
cli

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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:

  1. First character gets swallowed somehow. Have to press the first character twice. Found some issues about that one. And: Looks ike in_stream=False makes the first character appear on the first key press.
  2. 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/False does not seem to have an effect
  • in_stream=False will 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)
Lenguaje dominante
Python
Estrellas
4.8k
Forks
412
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de pyinvoke/invoke

Todos los issues de pyinvoke/invoke

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.