You've already forked sap-jenkins-library
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user