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

158
Vistas
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 Respuestas
Responde la pregunta

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 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