1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/pkg/command/execution.go
Daniel Kurzynski 0222bf83d1
Run npm scripts in virtual frame buffer and extend command.go to run executable asynchronously (#1669)
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
Co-authored-by: Florian Wilhelm <florian.wilhelm02@sap.com>
2020-06-16 11:42:51 +02:00

30 lines
596 B
Go

package command
import (
"os/exec"
"sync"
)
//errCopyStdout and errCopyStderr are filled after the command execution after Wait() terminates
type execution struct {
cmd *exec.Cmd
wg sync.WaitGroup
errCopyStdout error
errCopyStderr error
}
func (execution *execution) Kill() error {
return execution.cmd.Process.Kill()
}
func (execution *execution) Wait() error {
execution.wg.Wait()
return execution.cmd.Wait()
}
// Execution references a background process which is started by RunExecutableInBackground
type Execution interface {
Kill() error
Wait() error
}