Fix CLI exits with status 0 when error occurs (#1393)

This commit is contained in:
Ta-Ching Chen
2019-11-10 02:43:22 +08:00
committed by GitHub
parent c7d0c09f01
commit d443eb1c96
3 changed files with 10 additions and 4 deletions
+7 -1
View File
@@ -17,9 +17,15 @@ limitations under the License.
package main
import (
"os"
"github.com/fission/fission/cmd/fission-cli/app"
)
func main() {
app.App().Execute()
err := app.App().Execute()
if err != nil {
// let program exit with non-zero code when error occurs
os.Exit(1)
}
}
+1 -1
View File
@@ -70,7 +70,7 @@ func Commands() *cobra.Command {
wrapper.SetFlags(updateCmd, flag.FlagSet{
Required: []flag.Flag{flag.FnName},
Optional: []flag.Flag{flag.NamespaceFunction, flag.NamespaceEnvironment, flag.SpecSave,
flag.FnCode, flag.PkgSrcArchive, flag.PkgDeployArchive,
flag.FnCode, flag.PkgSrcArchive, flag.PkgDeployArchive, flag.FnEnvName,
flag.FnKeepURL, flag.FnEntryPoint, flag.FnBuildCmd, flag.FnPkgName, flag.HtUrl,
flag.HtMethod, flag.RunTimeMinCPU, flag.RunTimeMaxCPU, flag.RunTimeMinMemory,
flag.RunTimeMaxMemory, flag.ReplicasMin, flag.ReplicasMax, flag.FnExecutorType,
@@ -9,8 +9,8 @@ fn_nd=nodehellond
cleanup() {
echo "Cleaning up..."
popd
fission spec destroy || true
popd
}
trap cleanup EXIT
@@ -35,4 +35,4 @@ hnp=$(kubectl -n $FUNCTION_NAMESPACE get deployment -l=environmentName=$env_p -o
if [[ "${hnp}" == "foo-bar" ]]
then
echo "Hostname matches for poolmgr function, podspec test 2/2 passsed"
fi
fi