Skip to content

Commit

Permalink
Handle exit code of 1 when terminating Kibana process on windows (ela…
Browse files Browse the repository at this point in the history
…stic#24151)

* 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 <[email protected]>
  • Loading branch information
2 people authored and Liza Dayoub committed Oct 22, 2018
1 parent cf0dda0 commit 432ad3f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/kbn-dev-utils/src/proc_runner/proc.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,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}`);
Expand All @@ -118,9 +121,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();
},
Expand Down

0 comments on commit 432ad3f

Please sign in to comment.