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

[Backport 2.4] Temporarily prevents task-kill exceptions on Windows when it is passed a pid for a process that is already dead #2845

Merged
merged 1 commit into from
Nov 9, 2022
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
17 changes: 16 additions & 1 deletion packages/osd-opensearch/src/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,22 @@ exports.Cluster = class Cluster {
throw new Error('OpenSearch has not been started');
}

await treeKillAsync(this._process.pid);
/* Temporary fix for https://github.com/opensearch-project/OpenSearch-Dashboards/issues/2811
*
* `tree-kill` behaves differently on Windows, where it throws if `pid` is already dead, when
* compared to other operating systems, where it silently returns.
*/
try {
await treeKillAsync(this._process.pid);
} catch (ex) {
console.log('ex.message', ex.message);
if (
process.platform === 'win32' &&
!ex.message?.includes(`The process "${this._process.pid}" not found`)
) {
throw ex;
}
}

await this._outcome;
}
Expand Down