rolling back to an easier solution for executing unoconv as previous one did not remove zombies

This commit is contained in:
Julien Neuhart
2019-09-29 15:13:19 +02:00
parent 24e6a86bf5
commit 1b4c435900

View File

@@ -5,7 +5,6 @@ import (
"fmt"
"os"
"path/filepath"
"syscall"
"github.com/phayes/freeport"
"github.com/thecodingmachine/gotenberg/internal/pkg/conf"
@@ -110,26 +109,11 @@ func unoconv(ctx context.Context, logger xlog.Logger, fpath, destination string,
"unoconv",
args...,
)
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
if err != nil {
return err
}
xexec.LogBeforeExecute(logger, cmd)
if err := cmd.Start(); err != nil {
return err
}
result := make(chan error, 1)
go func() {
result <- cmd.Wait()
}()
select {
case err := <-result:
syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
return err
case <-ctx.Done():
syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
return ctx.Err()
}
return cmd.Run()
}
if err := resolver(); err != nil {
return xerror.New(op, err)