mirror of
https://github.com/Jguer/yay.git
synced 2024-11-07 01:27:21 +01:00
fix(vcs): add extra context to errors and increase timeouts (#2037)
* give a more complete message on vcs error * bump timeouts for vcs checking
This commit is contained in:
parent
68337a58c1
commit
01666aef37
@ -22,7 +22,7 @@ func UpDevel(
|
|||||||
toRemove := make([]string, 0)
|
toRemove := make([]string, 0)
|
||||||
toUpgrade := UpSlice{Up: make([]Upgrade, 0), Repos: []string{"devel"}}
|
toUpgrade := UpSlice{Up: make([]Upgrade, 0), Repos: []string{"devel"}}
|
||||||
|
|
||||||
ctxTimeout, cancel := context.WithTimeout(ctx, 5*time.Second)
|
ctxTimeout, cancel := context.WithTimeout(ctx, 20*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
for pkgName, pkg := range remote {
|
for pkgName, pkg := range remote {
|
||||||
if localCache.ToUpgrade(ctxTimeout, pkgName) {
|
if localCache.ToUpgrade(ctxTimeout, pkgName) {
|
||||||
|
@ -82,20 +82,20 @@ func (v *InfoStore) getCommit(ctx context.Context, url, branch string, protocols
|
|||||||
if len(protocols) > 0 {
|
if len(protocols) > 0 {
|
||||||
protocol := protocols[len(protocols)-1]
|
protocol := protocols[len(protocols)-1]
|
||||||
|
|
||||||
ctxTimeout, cancel := context.WithTimeout(ctx, 5*time.Second)
|
ctxTimeout, cancel := context.WithTimeout(ctx, 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
cmd := v.CmdBuilder.BuildGitCmd(ctxTimeout, "", "ls-remote", protocol+"://"+url, branch)
|
cmd := v.CmdBuilder.BuildGitCmd(ctxTimeout, "", "ls-remote", protocol+"://"+url, branch)
|
||||||
|
|
||||||
stdout, _, err := v.CmdBuilder.Capture(cmd)
|
stdout, stderr, err := v.CmdBuilder.Capture(cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exitError := &exec.ExitError{}
|
exitError := &exec.ExitError{}
|
||||||
if ok := errors.As(err, &exitError); ok && exitError.ExitCode() == 128 {
|
if ok := errors.As(err, &exitError); ok && exitError.ExitCode() == 128 {
|
||||||
v.logger.Warnln(gotext.Get("devel check for package failed: '%s' encountered an error", cmd.String()))
|
v.logger.Warnln(gotext.Get("devel check for package failed: '%s' encountered an error", cmd.String()), ": ", stderr)
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
v.logger.Warnln(err)
|
v.logger.Warnln(gotext.Get("devel check for package failed: '%s' encountered an error", cmd.String()), ": ", err)
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user