mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
* fix: Show error messages on fatal failures #32 * test: Add E2E test * test: fix E2E scripts * test: fix E2E scripts * fix: Race condition in concurrent analyzer * fix: update formatting to ensure docs URL is clickable Signed-off-by: Sahil Bansal <bansalsahil315@gmail.com> * fix: E2E test --------- Signed-off-by: Sahil Bansal <bansalsahil315@gmail.com> Co-authored-by: Sahil Bansal <bansalsahil315@gmail.com>
This commit is contained in:
co-authored by
Sahil Bansal
parent
b85f77cfbc
commit
4031219375
+11
-1
@@ -172,6 +172,8 @@ func (g *packageManagerGuard) continueExecution(ctx context.Context, pc *package
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
// We will fail based on executed command's exit code. This is important
|
||||
// because other tools (scripts, CI etc.) may depend on this exit code.
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
@@ -204,13 +206,19 @@ func (g *packageManagerGuard) concurrentAnalyzePackages(ctx context.Context,
|
||||
}()
|
||||
}
|
||||
|
||||
// Queue all packages for analysis
|
||||
for _, pkg := range packages {
|
||||
jobs <- pkg
|
||||
}
|
||||
close(jobs)
|
||||
|
||||
analysisResults := []*analyzer.PackageVersionAnalysisResult{}
|
||||
|
||||
// We must wait for the results go routine to collect all results
|
||||
rwg := sync.WaitGroup{}
|
||||
rwg.Add(1)
|
||||
go func() {
|
||||
defer rwg.Done()
|
||||
for result := range results {
|
||||
analysisResults = append(analysisResults, result)
|
||||
}
|
||||
@@ -219,8 +227,10 @@ func (g *packageManagerGuard) concurrentAnalyzePackages(ctx context.Context,
|
||||
waiter := make(chan struct{})
|
||||
go func() {
|
||||
wg.Wait()
|
||||
close(waiter)
|
||||
close(results)
|
||||
|
||||
rwg.Wait()
|
||||
close(waiter)
|
||||
}()
|
||||
|
||||
select {
|
||||
|
||||
Reference in New Issue
Block a user