I try to run a simple command via a Exec task in Gradle:
nohup ./xvfb_manage.sh start 40
which starts an Xvfb on :40. If I leave the nohup out, the script waits for an input before it returns so I try to suppress that with nohup. On shell it works fine. But in Gradle I can’t get it to work:
task('startXvfb', dependsOn: 'processShellScripts', type: Exec) {
def envVars = [:]
envVars['OPTS'] = "-DDISPLAY=:${xvfbDisplay}"
workingDir "${buildDir}/scripts"
commandLine 'nohup', './xvfb_manage.sh', 'start', "${xvfbDisplay}"
environment << envVars
}
If I run this via Jenkins the build stucks right after the Xvfb start and the output is not redirected to nohup.out. What is wrong with my call? I tried some other calls as well:
task('startXvfb', dependsOn: 'processShellScripts', type: Exec) {
...
executable 'nohup'
args './xvfb_manage.sh', 'start', "${xvfbDisplay}"
}
But this doesn’t work either. I thought the commandLine argument represents a full command-line where I can call my commands like on an actual CL? Any help is much appreciated!
EDIT: Here is the output from Jenkins: >:startXvfb >xvfb: Starting Xvfb on :106 >[dix] Could not init font path element /usr/share/fonts/truetype/, removing from list! >[dix] Could not init font path element /usr/share/fonts/TTF/, removing from list! >[dix] Could not init font path element /usr/share/fonts/OTF, removing from list! >[dix] Could not init font path element /usr/share/fonts/Type1/, removing from list! >[dix] Could not init font path element /usr/share/fonts/100dpi:unscaled, removing from list! >(EE) XKB: Couldn’t open rules file /usr/share/X11/xkb/rules/base >(EE) XKB: No components provided for device Virtual core keyboard >(EE) config/hal: NewInputDeviceRequest failed (2) >(EE) config/hal: NewInputDeviceRequest failed (2) >%here starts the infinite loop%
What I expect is: >nohup: ignoring input and appending output to ‘nohup.out’
Thanks in advance, Stefan