Handle exit code of 1 when terminating Kibana process on windows (#24151) (#24357)

* Handle exit code of 1 on windows

* Remove space to fix intake failure

* Update using solution from Spencer

* Update debug log message

Co-Authored-By: liza-mae <ldayoub@gmail.com>
This commit is contained in:
liza-mae 2018-10-23 09:24:05 -06:00 committed by GitHub
parent 79032f2deb
commit 1e8ed18065
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,6 +91,9 @@ export function createProc(name, { cmd, args, cwd, env, stdin, log }) {
const exit$ = Rx.fromEvent(childProcess, 'exit').pipe(
take(1),
map(([code]) => {
if (this._stopCalled) {
return null;
}
// JVM exits with 143 on SIGTERM and 130 on SIGINT, dont' treat then as errors
if (code > 0 && !(code === 143 || code === 130)) {
throw createCliError(`[${name}] exited with code ${code}`);
@ -115,9 +118,16 @@ export function createProc(name, { cmd, args, cwd, env, stdin, log }) {
return this._outcomePromise;
}
_stopCalled = false;
async stop(signal) {
if (this._stopCalled) {
return;
}
this._stopCalled = true;
await withTimeout(
async () => {
log.debug(`Sending "${signal}" to proc "${name}"`);
await treeKillAsync(childProcess.pid, signal);
await this.getOutcomePromise();
},