From 28fca42374f2e540f444210eaaa38c7778683af7 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 15 Aug 2019 17:30:07 +0100 Subject: [PATCH] Update node options Initialization on our scripts (#40302) (#43358) * chore(NA): update node options initilization on our scripts * chore(NA): re-export NODE_OPTIONS instead of re-setting on vars * chore(NA): missing doc comment --- bin/kibana | 2 +- bin/kibana-plugin | 2 +- bin/kibana-plugin.bat | 3 ++- bin/kibana.bat | 2 +- src/optimize/base_optimizer.js | 6 +++++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/kibana b/bin/kibana index 39c61808bbc0..558facb9da32 100755 --- a/bin/kibana +++ b/bin/kibana @@ -21,4 +21,4 @@ if [ ! -x "$NODE" ]; then exit 1 fi -NODE_ENV=production exec "${NODE}" --no-warnings --max-http-header-size=65536 $NODE_OPTIONS "${DIR}/src/cli" ${@} +NODE_OPTIONS="--no-warnings --max-http-header-size=65536 ${NODE_OPTIONS}" NODE_ENV=production exec "${NODE}" "${DIR}/src/cli" ${@} diff --git a/bin/kibana-plugin b/bin/kibana-plugin index 8b9ae268c253..b843d4966c6d 100755 --- a/bin/kibana-plugin +++ b/bin/kibana-plugin @@ -21,4 +21,4 @@ if [ ! -x "$NODE" ]; then exit 1 fi -NODE_ENV=production exec "${NODE}" $NODE_OPTIONS --no-warnings "${DIR}/src/cli_plugin" "$@" +NODE_OPTIONS="--no-warnings ${NODE_OPTIONS}" NODE_ENV=production exec "${NODE}" "${DIR}/src/cli_plugin" "$@" diff --git a/bin/kibana-plugin.bat b/bin/kibana-plugin.bat index 5a0ae70760ca..bf382a0657ad 100755 --- a/bin/kibana-plugin.bat +++ b/bin/kibana-plugin.bat @@ -14,7 +14,8 @@ If Not Exist "%NODE%" ( ) TITLE Kibana Server -"%NODE%" %NODE_OPTIONS% --no-warnings "%DIR%\src\cli_plugin" %* + +set "NODE_OPTIONS=--no-warnings %NODE_OPTIONS%" && "%NODE%" "%DIR%\src\cli_plugin" %* :finally diff --git a/bin/kibana.bat b/bin/kibana.bat index e4e6dfb4776a..9d8ba359e53a 100755 --- a/bin/kibana.bat +++ b/bin/kibana.bat @@ -14,7 +14,7 @@ If Not Exist "%NODE%" ( Exit /B 1 ) -"%NODE%" --no-warnings --max-http-header-size=65536 %NODE_OPTIONS% "%DIR%\src\cli" %* +set "NODE_OPTIONS=--no-warnings --max-http-header-size=65536 %NODE_OPTIONS%" && "%NODE%" "%DIR%\src\cli" %* :finally diff --git a/src/optimize/base_optimizer.js b/src/optimize/base_optimizer.js index ac72363b6722..bfeb12f0eba7 100644 --- a/src/optimize/base_optimizer.js +++ b/src/optimize/base_optimizer.js @@ -157,7 +157,11 @@ export default class BaseOptimizer { getThreadLoaderPoolConfig() { // Calculate the node options from the NODE_OPTIONS env var - const parsedNodeOptions = process.env.NODE_OPTIONS ? process.env.NODE_OPTIONS.split(/\s/) : []; + const parsedNodeOptions = process.env.NODE_OPTIONS + // thread-loader could not receive empty string as options + // or it would break that's why we need to filter here + ? process.env.NODE_OPTIONS.split(/\s/).filter(opt => !!opt) + : []; return { name: 'optimizer-thread-loader-main-pool',