Fix CLI exits with status 0 when error occurs (#1393)
This commit is contained in:
@@ -17,9 +17,15 @@ limitations under the License.
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/fission/fission/cmd/fission-cli/app"
|
"github.com/fission/fission/cmd/fission-cli/app"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ func Commands() *cobra.Command {
|
|||||||
wrapper.SetFlags(updateCmd, flag.FlagSet{
|
wrapper.SetFlags(updateCmd, flag.FlagSet{
|
||||||
Required: []flag.Flag{flag.FnName},
|
Required: []flag.Flag{flag.FnName},
|
||||||
Optional: []flag.Flag{flag.NamespaceFunction, flag.NamespaceEnvironment, flag.SpecSave,
|
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.FnKeepURL, flag.FnEntryPoint, flag.FnBuildCmd, flag.FnPkgName, flag.HtUrl,
|
||||||
flag.HtMethod, flag.RunTimeMinCPU, flag.RunTimeMaxCPU, flag.RunTimeMinMemory,
|
flag.HtMethod, flag.RunTimeMinCPU, flag.RunTimeMaxCPU, flag.RunTimeMinMemory,
|
||||||
flag.RunTimeMaxMemory, flag.ReplicasMin, flag.ReplicasMax, flag.FnExecutorType,
|
flag.RunTimeMaxMemory, flag.ReplicasMin, flag.ReplicasMax, flag.FnExecutorType,
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ fn_nd=nodehellond
|
|||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
echo "Cleaning up..."
|
echo "Cleaning up..."
|
||||||
popd
|
|
||||||
fission spec destroy || true
|
fission spec destroy || true
|
||||||
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|||||||
Reference in New Issue
Block a user