STOPING elasticsearch.bat -NODE JS

i'm using node js child_process module to run the elasticsearch.bat as follows
start:async()=>{

const { spawn } = require('child_process');
var bat = require.resolve('C:/elasticsearch-7.0.1/bin/elasticsearch.bat');
var run = require.resolve('main.bat');
var ls = spawn(bat,{run});
ls.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
ls.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
ls.on('close', (code) => {
console.log(child process close all stdio with code ${code});
});
ls.on('exit', function (code) {
console.log('child process exited with code ' + code);
});
},
i wrote this code inside elasticsearch.js file

after the run i'm doing some other tasks ..at end of all i need to close the terminal ...what is the way to do that ..i used "SIGINT" "SIGTERM" ..but not worked

flow of execution:
1.running main.bat
2.which will call main.js
3.from main.js calling the start() method of elasticsearch.js

Thanks in advance.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.