diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c6e04f4f2..53c4e42f33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to the Zowe Installer will be documented in this file. ## `2.16.0 ## Minor enhancements/defect fixes +- Enhancement: Reduced resource consumption by removal of one shell process per server that was used when starting each server. (#3812) - Enhancement: The command `zwe support` now includes CEE Runtime option output to better diagnose issues related to environment customization. (#3799) - Bugfix: zowe.network.validatePortFree and zowe.network.vipaIp variables were moved from zowe.network to zowe.network.server in the schema but not in the code, causing inability to use them without the workaround of specifying them as environment variables ZWE_NETWORK_VALIDATE_PORT_FREE and ZWE_NETWORK_VIPA_IP instead. Now, the variables match the schema: zowe.network.server is used instead of zowe.network. - Bugfix: configmgr operations now run with HEAPPOOLS64 set to OFF to avoid abends caused when this parameter is not OFF. (#3799) diff --git a/bin/commands/internal/start/component/index.ts b/bin/commands/internal/start/component/index.ts index 8e4a9a2351..e627ae2216 100644 --- a/bin/commands/internal/start/component/index.ts +++ b/bin/commands/internal/start/component/index.ts @@ -12,10 +12,12 @@ import * as std from 'cm_std'; import * as os from 'cm_os'; import * as zos from 'zos'; +import * as xplatform from 'xplatform'; import * as common from '../../../../libs/common'; import * as config from '../../../../libs/config'; import * as shell from '../../../../libs/shell'; import * as varlib from '../../../../libs/var'; +import * as stringlib from '../../../../libs/string'; import * as java from '../../../../libs/java'; import * as fs from '../../../../libs/fs'; import * as component from '../../../../libs/component'; @@ -93,8 +95,26 @@ export function execute(componentId: string, runInBackground: boolean=false) { } else { // wait for all background subprocesses created by bin/start.sh exit // re-source libs is necessary to reclaim shell functions since this will be executed in a new shell - //TODO does this do the same as the shell script before it? - shell.execSync('sh', '-c', `cd ${COMPONENT_DIR} ; cat "${fullPath}" | { echo ". \"${ZOWE_CONFIG.zowe.runtimeDirectory}/bin/libs/configmgr-index.sh\"" ; cat ; echo; echo wait; } | /bin/sh`); + const startScriptContents = `cd ${COMPONENT_DIR} ; . "${ZOWE_CONFIG.zowe.runtimeDirectory}/bin/libs/configmgr-index.sh" ; ${xplatform.loadFileUTF8(fullPath, xplatform.AUTO_DETECT)} ; wait;`; + const pipeArray = os.pipe(); + if (!pipeArray) { + common.printFormattedError("ZWELS", "zwe-internal-start-component", `Error ZWEL0064E: failed to run command os.pipe - Cannot start component ${componentId}`); + return; + } + //TODO this will not work with unicode codepoints longer than a byte + const buf = new ArrayBuffer(startScriptContents.length); + const view = new Uint8Array(buf); + const ebcdicString = stringlib.asciiToEbcdic(startScriptContents); + for (let i = 0; i < startScriptContents.length; i++) { + view[i] = ebcdicString.charCodeAt(i); + } + + os.write(pipeArray[1], buf, 0, startScriptContents.length); + os.close(pipeArray[1]); + os.exec(['/bin/sh'], + {block: true, usePath: true, stdin: pipeArray[0]}); + os.close(pipeArray[0]); + } } else { common.printFormattedError("ZWELS", "zwe-internal-start-component", `Error ZWEL0172E: Component ${componentId} has commands.start defined but the file is missing.`);