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

157
Visualizações
Ruby equivalent of syscall.Exec in golang

I want to set environment variable programatically with ruby. In Golang we have

syscall.Exec(os.Getenv(SHELL), []string{os.Getenv(SHELL)}, updated)

This opens a new default shell with the updated variables. So the terminal where we execute the go program will have those variables persisted for the session.

I'm new to ruby not able to find the equivalent there. Please help me.

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

0

To get/set environment variables, you could use ENV hash, then to make system calls, where you could see the standard output (not as ` that will return you the output as a string), you could call system.
The default shell should be available in ENV['SHELL'], so what you'll need should be something like:

ENV['FOO'] = '123' # FOO will last for the entire ruby session
system({'BAR' => '456'}, ENV['SHELL']) # BAR will last until system call has finished
system(ENV['SHELL']) # Here, only FOO will be available, not BAR
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