1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-12-01 23:02:43 +02:00

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>
This commit is contained in:
Daniel Kurzynski
2020-06-16 11:42:51 +02:00
committed by GitHub
parent b0329cd2c0
commit 0222bf83d1
9 changed files with 180 additions and 30 deletions

View File

@@ -1,6 +1,7 @@
package cmd
import (
"fmt"
"github.com/SAP/jenkins-library/pkg/command"
"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/npm"
@@ -71,6 +72,15 @@ func runNpmExecuteScripts(utils npmExecuteScriptsUtilsInterface, options *npmExe
return err
}
if options.VirtualFrameBuffer {
cmd, err := execRunner.RunExecutableInBackground("Xvfb", "-ac", ":99", "-screen", "0", "1280x1024x16")
if err != nil {
return fmt.Errorf("failed to start virtual frame buffer%w", err)
}
defer cmd.Kill()
execRunner.SetEnv([]string{"DISPLAY=:99"})
}
for _, file := range packageJSONFiles {
dir := path.Dir(file)
err = utils.chdir(dir)