1
0
mirror of https://github.com/strongdm/comply synced 2024-11-05 15:35:25 +00:00

fix channel infinite wait (#100)

This commit is contained in:
vassalo 2021-10-11 10:43:32 -03:00
parent fb6d1c0bdd
commit bc25dae339
3 changed files with 10 additions and 4 deletions

View File

@ -49,7 +49,7 @@ func renderToFilesystem(wg *sync.WaitGroup, errOutputCh chan error, data *render
rel, err := filepath.Rel(config.ProjectRoot(), p.FullPath)
if err != nil {
rel = p.FullPath
rel = p.FullPat
}
fmt.Printf("%s -> %s\n", rel, filepath.Join("output", p.OutputFilename))
}(doc)

View File

@ -64,9 +64,11 @@ func dockerPandoc(outputFilename string, errOutputCh chan error) {
errOutputCh <- errors.Wrap(err, "unable to remove container")
return
}
errOutputCh <-nil
}()
if err := cli.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{}); err != nil {
err = cli.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{})
if err != nil {
errOutputCh <- errors.Wrap(err, "unable to start Docker container")
return
}
@ -90,8 +92,6 @@ func dockerPandoc(outputFilename string, errOutputCh chan error) {
errOutputCh <- errors.Wrap(err, "output not generated; verify your Docker image is up to date")
return
}
errOutputCh <- nil
}
// 🐼

View File

@ -42,6 +42,12 @@ func pdf(output string, live bool, errCh chan error, wg *sync.WaitGroup) {
for _, narrative := range narratives {
renderToFilesystem(&pdfWG, errOutputCh, data, narrative, live)
err = <-errOutputCh
if err != nil {
errCh <- err
wg.Done()
return
}
}
pdfWG.Wait()