mirror of
https://github.com/strongdm/comply
synced 2024-11-05 15:35:25 +00:00
Fix error handling inside pandocPandoc func (#100)
Other changes: - Updated strongdm/pandoc image references to edge Co-authored-by: vassalo <vassalo@users.noreply.github.com>
This commit is contained in:
parent
3d8652f497
commit
c78f9007c2
@ -1,4 +1,4 @@
|
||||
FROM strongdm/pandoc:latest
|
||||
FROM strongdm/pandoc:edge
|
||||
|
||||
# based on implementation by James Gregory <james@jagregory.com>
|
||||
MAINTAINER Comply <comply@strongdm.com>
|
||||
|
4
Makefile
4
Makefile
@ -52,8 +52,8 @@ else
|
||||
endif
|
||||
|
||||
docker:
|
||||
cd build && docker build -t strongdm/pandoc .
|
||||
docker push strongdm/pandoc
|
||||
cd build && docker build -t strongdm/pandoc:edge .
|
||||
docker push strongdm/pandoc:edge
|
||||
|
||||
cleanse:
|
||||
git checkout --orphan newbranch
|
||||
|
@ -274,7 +274,7 @@ var pandocImageExists = func(ctx context.Context) bool {
|
||||
return false
|
||||
}
|
||||
for _, image := range imageList {
|
||||
if strings.Contains(image.RepoTags[0], "strongdm/pandoc") {
|
||||
if strings.Contains(image.RepoTags[0], "strongdm/pandoc:edge") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@ -352,7 +352,7 @@ func cleanContainers(c *cli.Context) error {
|
||||
|
||||
for _, c := range containers {
|
||||
// assume this container was leftover from previous aborted run
|
||||
if strings.HasPrefix(c.Image, "strongdm/pandoc") {
|
||||
if strings.HasPrefix(c.Image, "strongdm/pandoc:edge") {
|
||||
d := time.Second * 2
|
||||
err = cli.ContainerStop(ctx, c.ID, &d)
|
||||
if err != nil {
|
||||
|
@ -18,10 +18,7 @@ var pandocArgs = []string{"-f", "markdown+smart", "--toc", "-N", "--template", "
|
||||
|
||||
func pandoc(outputFilename string, errOutputCh chan error) {
|
||||
if config.WhichPandoc() == config.UsePandoc {
|
||||
err := pandocPandoc(outputFilename)
|
||||
if err != nil {
|
||||
errOutputCh <- err
|
||||
}
|
||||
pandocPandoc(outputFilename, errOutputCh)
|
||||
} else {
|
||||
dockerPandoc(outputFilename, errOutputCh)
|
||||
}
|
||||
@ -47,7 +44,7 @@ func dockerPandoc(outputFilename string, errOutputCh chan error) {
|
||||
}
|
||||
|
||||
resp, err := cli.ContainerCreate(ctx, &container.Config{
|
||||
Image: "strongdm/pandoc",
|
||||
Image: "strongdm/pandoc:edge",
|
||||
Cmd: pandocCmd},
|
||||
hc, nil, nil, "")
|
||||
|
||||
@ -95,12 +92,14 @@ func dockerPandoc(outputFilename string, errOutputCh chan error) {
|
||||
}
|
||||
|
||||
// 🐼
|
||||
func pandocPandoc(outputFilename string) error {
|
||||
func pandocPandoc(outputFilename string, errOutputCh chan error) error {
|
||||
cmd := exec.Command("pandoc", append(pandocArgs, fmt.Sprintf("output/%s", outputFilename), fmt.Sprintf("output/%s.md", outputFilename))...)
|
||||
outputRaw, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
fmt.Println(string(outputRaw))
|
||||
return errors.Wrap(err, "error calling pandoc")
|
||||
errOutputCh <- errors.Wrap(err, "error calling pandoc")
|
||||
} else {
|
||||
errOutputCh <- nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user