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

262
Vistas
How do I create an IPC channel with a detached process in Node JS?

I am currently making a Minecraft server to be controlled with Node JS and child process. However, when trying to execute a minecraft command from node to be passed to the server, the server doesn't respond at all. After tinkering with it a bit I found that while the server is running properly, the server process is not connected with the parent node process. This is the code I am using:

//Spawn and run the server
var svEnv = cp.spawn("java", [
   "-Xms4096M",
   "-Xmx4096M",
   "-jar",
   "server.jar",
   "nogui"
], {
   shell: false,
   detached: true, 
   cwd: `${config.server.directoryPath}`,
   stdio: "pipe"
});
svEnv.unref();

To test executing a command I simply use svEnv.stdin.write(`${cmd}\n`). I've noticed what when detached is set to false, the commands execute fine, however when detached is enabled the server ignores the inputs, yet the callback function still executes when the write is done executing. I checked the connection properties of the server process:

svEnv.stdin.writable -> true

svEnv.connected -> false

I'm guessing that the detached option being set to true disconnects the IPC channels between the child and the parent.

Is it possible to have the IPC channels still be functional when the child process is detached?

note: I am using windows 10

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