From 4ecf674e62088572e787134364f30db62315806a Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Tue, 28 Dec 2021 20:44:04 +0100 Subject: [PATCH] fix(git): return empty on error --- src/segment_git.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/segment_git.go b/src/segment_git.go index 0a16d5b4..32923e5f 100644 --- a/src/segment_git.go +++ b/src/segment_git.go @@ -310,7 +310,10 @@ func (g *git) getGitCommand() string { func (g *git) getGitCommandOutput(args ...string) string { args = append([]string{"-C", g.gitRealFolder, "--no-optional-locks", "-c", "core.quotepath=false", "-c", "color.status=false"}, args...) - val, _ := g.env.runCommand(g.getGitCommand(), args...) + val, err := g.env.runCommand(g.getGitCommand(), args...) + if err != nil { + return "" + } return val }