From f9927cb1659fed014bb97a77260c738ab9e19c85 Mon Sep 17 00:00:00 2001 From: liza-mae Date: Mon, 22 Oct 2018 12:11:29 -0600 Subject: [PATCH] Handle exit code of 1 when terminating Kibana process on windows (#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 --- packages/kbn-dev-utils/src/proc_runner/proc.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/kbn-dev-utils/src/proc_runner/proc.js b/packages/kbn-dev-utils/src/proc_runner/proc.js index f473026418109..c2548bccfac7c 100644 --- a/packages/kbn-dev-utils/src/proc_runner/proc.js +++ b/packages/kbn-dev-utils/src/proc_runner/proc.js @@ -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(); },