mirror of
https://github.com/Jguer/yay.git
synced 2025-10-08 00:04:37 -04:00
fix(install): fix missing error display in install
This commit is contained in:
parent
cedbcfbcda
commit
b7f9a5e677
14
cmd.go
14
cmd.go
@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
alpm "github.com/Jguer/go-alpm/v2"
|
alpm "github.com/Jguer/go-alpm/v2"
|
||||||
"github.com/leonelquinteros/gotext"
|
"github.com/leonelquinteros/gotext"
|
||||||
@ -222,8 +223,17 @@ func handleQuery(ctx context.Context, cmdArgs *parser.Arguments, dbExecutor db.E
|
|||||||
return printUpdateList(ctx, cmdArgs, dbExecutor, cmdArgs.ExistsDouble("u", "sysupgrade"), filter)
|
return printUpdateList(ctx, cmdArgs, dbExecutor, cmdArgs.ExistsDouble("u", "sysupgrade"), filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
return config.Runtime.CmdBuilder.Show(config.Runtime.CmdBuilder.BuildPacmanCmd(ctx,
|
if err := config.Runtime.CmdBuilder.Show(config.Runtime.CmdBuilder.BuildPacmanCmd(ctx,
|
||||||
cmdArgs, config.Runtime.Mode, settings.NoConfirm))
|
cmdArgs, config.Runtime.Mode, settings.NoConfirm)); err != nil {
|
||||||
|
if str := err.Error(); strings.Contains(str, "exit status") {
|
||||||
|
// yay -Qdt should not output anything in case of error
|
||||||
|
return fmt.Errorf("")
|
||||||
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleHelp(ctx context.Context, cmdArgs *parser.Arguments) error {
|
func handleHelp(ctx context.Context, cmdArgs *parser.Arguments) error {
|
||||||
|
@ -262,7 +262,7 @@ func install(ctx context.Context, cmdArgs *parser.Arguments, dbExecutor db.Execu
|
|||||||
cloned, errA := download.AURPKGBUILDRepos(ctx,
|
cloned, errA := download.AURPKGBUILDRepos(ctx,
|
||||||
config.Runtime.CmdBuilder, toClone, config.AURURL, config.BuildDir, false)
|
config.Runtime.CmdBuilder, toClone, config.AURURL, config.BuildDir, false)
|
||||||
if errA != nil {
|
if errA != nil {
|
||||||
return err
|
return errA
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
8
main.go
8
main.go
@ -5,7 +5,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
|
||||||
|
|
||||||
pacmanconf "github.com/Morganamilo/go-pacmanconf"
|
pacmanconf "github.com/Morganamilo/go-pacmanconf"
|
||||||
"github.com/leonelquinteros/gotext"
|
"github.com/leonelquinteros/gotext"
|
||||||
@ -161,11 +160,10 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defer dbExecutor.Cleanup()
|
defer dbExecutor.Cleanup()
|
||||||
err = handleCmd(ctx, cmdArgs, db.Executor(dbExecutor))
|
|
||||||
|
|
||||||
if err != nil {
|
if err = handleCmd(ctx, cmdArgs, db.Executor(dbExecutor)); err != nil {
|
||||||
if str := err.Error(); str != "" && !strings.Contains(str, "exit status") {
|
if str := err.Error(); str != "" {
|
||||||
fmt.Fprintln(os.Stderr, str)
|
text.Errorln(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
if exitError, ok := err.(*exec.ExitError); ok {
|
if exitError, ok := err.(*exec.ExitError); ok {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user