|
|
|
@ -15,7 +15,9 @@
|
|
|
|
|
package genutil
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"errors"
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/OpenIMSDK/tools/errs"
|
|
|
|
|
"os"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
)
|
|
|
|
@ -41,6 +43,9 @@ func OutDir(path string) (string, error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ExitWithError(err error) {
|
|
|
|
|
if errors.Is(errs.Unwrap(err), errors.New("SIGTERM received, shutting down")) {
|
|
|
|
|
os.Exit(-1)
|
|
|
|
|
}
|
|
|
|
|
progName := filepath.Base(os.Args[0])
|
|
|
|
|
fmt.Fprintf(os.Stderr, "\n\n%s exit -1: \n%+v\n\n", progName, err)
|
|
|
|
|
os.Exit(-1)
|
|
|
|
|