Fix incorrect CLI exit code and duplicate error message (#26346)

Follow the CLI refactoring, and add tests.
This commit is contained in:
wxiaoguang 2023-08-05 23:36:45 +08:00 committed by GitHub
parent 4f513474dc
commit d92b4cd093
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 98 additions and 27 deletions

View file

@ -33,3 +33,9 @@ func RedirectURL(resp http.ResponseWriter) string {
func IsNormalPageCompleted(s string) bool {
return strings.Contains(s, `<footer class="page-footer"`) && strings.Contains(s, `</html>`)
}
func MockVariableValue[T any](p *T, v T) (reset func()) {
old := *p
*p = v
return func() { *p = old }
}