Make CLI functions return error instead of fatal out (#1379)
Before this PR, CLI functions fatal out when encountering error instead of returning it. Such behavior makes it hard to reuse the functions nor writing unit tests. This PR aims to make functions return errors instead of error out.
This commit is contained in:
@@ -17,11 +17,16 @@ limitations under the License.
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
fcli "github.com/fission/fission/pkg/fission-cli"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fcli.NewCliApp().Run(os.Args)
|
||||
err := fcli.NewCliApp().Run(os.Args)
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %v\n", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user