Skip to main content
Version: 1.7.3

Simulating the exit of script function execution

Introduction

An experiment that simulates the exit of script function execution will be performed after specifying the script and its function.

CLI Command

  • blade create script exit -h

Parameter

NameIntroductionTypeRequiredExample Value
exit-codeExit code(Default value: 1)intN1
exit-messageExit messagestringNthis-is-error-message
filePath to the scriptstringYtest.sh
function-nameFunction name in the scriptstringYstart0
timeoutRunning time(s)intN20

Case

# blade create script exit --exit-code 1 --exit-message this-is-error-message --file test.sh --function-name start0
{"code":200,"success":true,"result":"d8a016b96380d7f3"}

# The echo and exit commands will be added to the script:
start0() {
echo this-is-error-message;exit 1
...
}

Principle

After backing up the original script, the echo and exit commands will be added to the function by the function name. Finally, the original script will be restored after the experiment is destroyed.

Q&A

Q: {"code":602,"success":false,"error":"get too many lines by the install function name"}

A:Execution failed because multiple functions were found.