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

342
Vistas
How can I wait for a check to test if a process is running to finish?

I am writing an Electron app. I have this very simple function which at the moment is just returning an empty array:

async GetStuff()
{
   var result:string[] = [];

   var bExists = false;

   var exec = require('child_process').exec;

   exec("tasklist", (err:any, stdout:any, stderr:any) => {
       err = err;
       stderr = stderr;
       bExists = stdout.toLowerCase().indexOf("unixsrv.exe") > -1;
   });

   return result
}

As it is, it correctly reports if a process named "unixsrv.exe" is running or not.

Thing is, the function as it is will first hit the "return result" line and later will hit the "bExists = " line.

How can modify the above so that I do not return until I have the answer as to whether or not the process exists?

More generically: How can I synchronously test whether a process is running or not?

Thanks for any help.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I have found the answer that works for me here:

node.js how to check a process is running by the process name?

It is the answer posted there by Christiaan Maks

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