zowe / zowe-install-packaging

Packaging repository for the Zowe install scripts and files
Eclipse Public License 2.0
26 stars 52 forks source link

bin/libs/common.sh: print_error_and_exit can not use error codes > 255 #3828

Open Martin-Zeithaml opened 1 month ago

Martin-Zeithaml commented 1 month ago

The function print_error_and_exit is ending with exit command, which accepts any number, however only the least significant 8bits are used.

For example: in case of missing useConfigmgr=true, this returns 60:

/zowe/bin: ./zwe components search --component-id org.zowe.zlux.sample.angular
Error ZWEL0316E: Command requires zowe.useConfigmgr=true to use.
/zowe/bin: echo $?
60
JoeNemo commented 1 month ago

Sean suggests returning 8 for all failures and putting the particular status in a environment variable.

Martin-Zeithaml commented 1 month ago

And the same for JS:

echo "import * as std from 'cm_std'; std.exit(316);" > test_exit.js
/zowe/bin/utils/configmgr -script test_exit.js
echo $?
60
JoeNemo commented 1 month ago

This is an external breaking changes and should be done within the 3.0 releases.