Skip to content

Commit

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

* 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
liza-mae and liza-mae authored Oct 22, 2018
1 parent 53011f7 commit f9927cb
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 @@ -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}`);
Expand All @@ -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();
},
Expand Down

0 comments on commit f9927cb

Please sign in to comment.