Skip to content

Commit 23dd90f

Browse files
committed
fix
1 parent 97589cf commit 23dd90f

File tree

6 files changed

+5
-29
lines changed

6 files changed

+5
-29
lines changed

cmd/admin_user_change_password_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"code.gitea.io/gitea/models/db"
1010
"code.gitea.io/gitea/models/unittest"
1111
user_model "code.gitea.io/gitea/models/user"
12+
1213
"github.com/stretchr/testify/assert"
1314
"github.com/stretchr/testify/require"
1415
)

cmd/admin_user_create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func runCreateUser(ctx context.Context, c *cli.Command) error {
135135
}
136136

137137
if !setting.IsInTesting {
138-
// FIXME: need to refactor the "installSignals/initDB" related code later
138+
// FIXME: need to refactor the "initDB" related code later
139139
// it doesn't make sense to call it in (almost) every command action function
140140
if err := initDB(ctx); err != nil {
141141
return err

cmd/admin_user_delete.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func microcmdUserDelete() *cli.Command {
4444
Action: runDeleteUser,
4545
}
4646
}
47+
4748
func runDeleteUser(ctx context.Context, c *cli.Command) error {
4849
if !c.IsSet("id") && !c.IsSet("username") && !c.IsSet("email") {
4950
return errors.New("You must provide the id, username or email of a user to delete")

cmd/admin_user_delete_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ func TestAdminUserDelete(t *testing.T) {
4444
err := microcmdUserDelete().Run(ctx, []string{"delete-test", "--username", "testuser"})
4545
require.NoError(t, err)
4646
unittest.AssertNotExistsBean(t, &user_model.User{LowerName: "testuser"})
47-
4847
})
4948
t.Run("delete user by email", func(t *testing.T) {
5049
setupTestUser(t)

cmd/admin_user_must_change_password_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"code.gitea.io/gitea/models/db"
1010
"code.gitea.io/gitea/models/unittest"
1111
user_model "code.gitea.io/gitea/models/user"
12+
1213
"github.com/stretchr/testify/assert"
1314
"github.com/stretchr/testify/require"
1415
)

contrib/backport/backport.go

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ import (
1212
"net/http"
1313
"os"
1414
"os/exec"
15-
"os/signal"
1615
"path"
1716
"strconv"
1817
"strings"
19-
"syscall"
2018

2119
"github.com/google/go-github/v71/github"
2220
"github.com/urfave/cli/v3"
@@ -105,9 +103,7 @@ OPTIONS:
105103
`
106104

107105
app.Action = runBackport
108-
ctx, cancel := installSignals()
109-
defer cancel()
110-
if err := app.Run(ctx, os.Args); err != nil {
106+
if err := app.Run(context.Background(), os.Args); err != nil {
111107
fmt.Fprintf(os.Stderr, "Unable to backport: %v\n", err)
112108
}
113109
}
@@ -458,25 +454,3 @@ func determineSHAforPR(ctx context.Context, prStr, accessToken string) (string,
458454

459455
return "", nil
460456
}
461-
462-
func installSignals() (context.Context, context.CancelFunc) {
463-
ctx, cancel := context.WithCancel(context.Background())
464-
go func() {
465-
// install notify
466-
signalChannel := make(chan os.Signal, 1)
467-
468-
signal.Notify(
469-
signalChannel,
470-
syscall.SIGINT,
471-
syscall.SIGTERM,
472-
)
473-
select {
474-
case <-signalChannel:
475-
case <-ctx.Done():
476-
}
477-
cancel()
478-
signal.Reset()
479-
}()
480-
481-
return ctx, cancel
482-
}

0 commit comments

Comments
 (0)