mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 12:49:52 +01:00
Fix stderr usages (#26477)
This commit is contained in:
parent
ca74b074ea
commit
82ea557dd3
3 changed files with 5 additions and 8 deletions
|
@ -6,7 +6,6 @@ package cmd
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
auth_model "code.gitea.io/gitea/models/auth"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
|
@ -87,7 +86,7 @@ func runCreateUser(c *cli.Context) error {
|
|||
username = c.String("username")
|
||||
} else {
|
||||
username = c.String("name")
|
||||
fmt.Fprintf(os.Stderr, "--name flag is deprecated. Use --username instead.\n")
|
||||
_, _ = fmt.Fprintf(c.App.ErrWriter, "--name flag is deprecated. Use --username instead.\n")
|
||||
}
|
||||
|
||||
ctx, cancel := installSignals()
|
||||
|
|
|
@ -7,7 +7,6 @@ package migrations
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"code.gitea.io/gitea/models/migrations/v1_10"
|
||||
"code.gitea.io/gitea/models/migrations/v1_11"
|
||||
|
@ -608,8 +607,7 @@ Please try upgrading to a lower version first (suggested v1.6.4), then upgrade t
|
|||
if !setting.IsProd {
|
||||
msg += fmt.Sprintf("\nIf you are in development and really know what you're doing, you can force changing the migration version by executing: UPDATE version SET version=%d WHERE id=1;", minDBVersion+len(migrations))
|
||||
}
|
||||
_, _ = fmt.Fprintln(os.Stderr, msg)
|
||||
log.Fatal(msg)
|
||||
log.Fatal("Migration Error: %s", msg)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
"html/template"
|
||||
"io"
|
||||
"net/url"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -1152,14 +1151,15 @@ func GetDiff(gitRepo *git.Repository, opts *DiffOptions, files ...string) (*Diff
|
|||
}()
|
||||
|
||||
go func() {
|
||||
stderr := &bytes.Buffer{}
|
||||
cmdDiff.SetDescription(fmt.Sprintf("GetDiffRange [repo_path: %s]", repoPath))
|
||||
if err := cmdDiff.Run(&git.RunOpts{
|
||||
Timeout: time.Duration(setting.Git.Timeout.Default) * time.Second,
|
||||
Dir: repoPath,
|
||||
Stderr: os.Stderr,
|
||||
Stdout: writer,
|
||||
Stderr: stderr,
|
||||
}); err != nil {
|
||||
log.Error("error during RunWithContext: %w", err)
|
||||
log.Error("error during GetDiff(git diff dir: %s): %v, stderr: %s", repoPath, err, stderr.String())
|
||||
}
|
||||
|
||||
_ = writer.Close()
|
||||
|
|
Loading…
Reference in a new issue