Skip to content

Commit

Permalink
chore(NA): exit early with link for docs when using kbn_pm on windows (
Browse files Browse the repository at this point in the history
…#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 <[email protected]>
Co-authored-by: Spencer <[email protected]>
  • Loading branch information
3 people authored Feb 10, 2023
1 parent c3adc5b commit 7242c1a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kbn_pm/src/cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -40,6 +41,7 @@ async function tryToGetCiStatsReporter(log) {
}

try {
checkIfRunningNativelyOnWindows(log);
const cmd = getCmd(cmdName);

if (cmdName && !cmd) {
Expand Down
21 changes: 21 additions & 0 deletions kbn_pm/src/lib/windows.mjs
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit 7242c1a

Please sign in to comment.