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

212
Visualizações
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 à 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