Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

188
Vistas
STDIN.getpass does not always show the key icon in the terminal

How can I make sure that the key icon (see img for sample) always appears every time I call STDIN.getpass? The issue is intermittent, sometimes I get the icon and sometimes I don't. I could not find a reliable repro step.

enter image description here

How my code currently looks like:

  $stdout.flush
  # to hide the password while being typed in the terminal
  STDIN.getpass
  • I thought $stdout.flush would resolve my problem but it did not.
  • STDIN.getpass is being returned so its not assigned to any variables.
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

They key icon itself isn't so much related to the STDIN.getpass function which is very simple and you can see it here:

https://github.com/ruby/io-console/blob/master/lib/io/console/ffi/common.rb#L9-L21

the noecho block is just setting the tty_mode to noecho (see https://github.com/ruby/ruby/blob/d92f09a5eea009fa28cd046e9d0eb698e3d94c5c/ext/io/console/console.c#L602)

So, I think this question is actually better as: "How come my Terminal program on my operating system doesn't always show a key icon, when the tty_mode is set to noecho.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda