chore(NA): exit early with link for docs when using kbn_pm on windows (#139745)

This PR allow us to print an error message with a link to the docs when
using kbn_pm on Windows outside of a WSL environment.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Spencer <spencer@elastic.co>
This commit is contained in:
Tiago Costa 2023-02-10 15:38:29 +00:00 committed by GitHub
parent c3adc5b29c
commit 7242c1a6c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View file

@ -18,6 +18,7 @@
import { Args } from './lib/args.mjs';
import { getHelp } from './lib/help.mjs';
import { createFlagError, isCliError } from './lib/cli_error.mjs';
import { checkIfRunningNativelyOnWindows } from './lib/windows.mjs';
import { getCmd } from './commands/index.mjs';
import { Log } from './lib/log.mjs';
import External from './lib/external_packages.js';
@ -40,6 +41,7 @@ async function tryToGetCiStatsReporter(log) {
}
try {
checkIfRunningNativelyOnWindows(log);
const cmd = getCmd(cmdName);
if (cmdName && !cmd) {

View file

@ -0,0 +1,21 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
/**
* @param {import('./log.mjs').Log} log
*/
export function checkIfRunningNativelyOnWindows(log) {
if (process.platform !== 'win32') {
return;
}
log.error(
'We no longer support natively bootstrap Kibana on Windows. Please check our documentation on how you can develop on Windows at https://docs.elastic.dev/kibana-dev-docs/tutorial/setup-windows-development-wsl'
);
process.exit(1);
}