CMD still running when packaged app executed from CMD


#1

I’m calling my Electron Packaged App from a CMD, when I close my app, the CMD is still up, like listening to the app.
I tried everything, even the “removealllisteners” thing…

This is my code

app.on('quit', function (event, exitCode) {
process.emit('exit', exitCode)
})
process.exit = app.exit

app.on("window-all-closed", function() {
app.quit();
});

app.on('before-quit', () => {
if (process.platform !== "darwin") {
var cerrarSesion = async function() {
try {
SQLINSERT =
"DELETE FROM SESION_USUARIO WHERE USUARIO='" + usuarioSistema + "'";
console.log("SQL INSERT " + SQLINSERT);
const pool = await poolPromise;
const result = await pool.request().query(SQLINSERT, err => {
if (err) {
console.log(err);
}
});
} catch (err) {
console.log(err);
}
};
cerrarSesion();
}
});

image