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

211
Vistas
Respond to nodejs spawned child process

Been trying to respond to a CLI tool which prompts two questions before running so I tried to create a script for automation. Problem is: respond is not submitted. Searched this for hours and literally read every other stackoverflow question about this topic but none of these solutions seems to work. here's my code:

const moralis = spawn(
      `moralis-admin-cli connect-local-devchain --moralisApiKey ${process.env.MORALIS_API_KEY} --moralisApiSecret ${process.env.MORALIS_API_SECRET} --frpcPath ${process.env.FRPC_PATH}`,
      {
        shell: true,
      }
    );

moralis.stdout.setEncoding("utf8");
moralis.stdout.pipe(process.stdout);

moralis.stdout.on("data", function (data) {
 if (data.includes("What server")) {
   moralis.stdin.write("0" + "\n");
   moralis.stdin.end();
 }
});

running that just prints the prompt of the CLI tool and doesn't submit anything. If I use process.stdin.write it actually prints the 0 response but also doesn't submit it. From my understand the end call should actually submit my response? Also why don't I see the response in shell when I use moralis.stdin.write?

cheers!

about 4 years ago · Juan Pablo Isaza
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