Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

185
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda