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

288
Visualizações
How to silence `Shell` (ruby stdlib) `notify` feature?
require 'shell'
sh = Shell.new
sh.verbose = false
sh.debug = false
print sh.system('date')

Expected output

Wed Nov 10 13:08:09 EST 2021

Observed output

shell(#<Th:0x00007fd016064058 run>): /bin/date
Wed Nov 10 13:08:09 EST 2021

The unwanted line comes from Shell::CommandProcessor#notify

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

After some investigation there seems to be a confusing design flaw (or feature?) in Shell. Initally it seems you should be able to mutate verbose and debug on an instance of Shell, but it turns out the root notify method itself lives in the class, not the instance.

Hence instance level settings will only have limited effect, as the class method Shell.notify will be unaware of instance settings.

Solution - use class-level settings instead:

Shell.verbose = false
Shell.debug   = false

Output will now be only:

Wed Nov 10 13:08:09 EST 2021
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