Forráskód Böngészése

lil hack to avoid scans 'finishing' when git errors are present (#726)

Zachary Rice 4 éve
szülő
commit
9ae1def963
1 módosított fájl, 3 hozzáadás és 0 törlés
  1. 3 0
      git/git.go

+ 3 - 0
git/git.go

@@ -7,6 +7,7 @@ import (
 	"os/exec"
 	"path/filepath"
 	"strings"
+	"time"
 
 	"github.com/gitleaks/go-gitdiff/gitdiff"
 	"github.com/rs/zerolog/log"
@@ -39,6 +40,7 @@ func GitLog(source string, logOpts string) (<-chan *gitdiff.File, error) {
 	}
 
 	go listenForStdErr(stderr)
+	time.Sleep(50 * time.Millisecond) // HACK: to avoid https://github.com/zricethezav/gitleaks/issues/722
 
 	return gitdiff.Parse(stdout)
 }
@@ -66,6 +68,7 @@ func GitDiff(source string, staged bool) (<-chan *gitdiff.File, error) {
 	}
 
 	go listenForStdErr(stderr)
+	time.Sleep(50 * time.Millisecond) // HACK: to avoid https://github.com/zricethezav/gitleaks/issues/722
 
 	return gitdiff.Parse(stdout)
 }