Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Oct 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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