Executable in task doesn't appear to actually be running and not printing expected output to console


(dmolineu) #1

I’m working on a build that will undeploy and deploy war files to tc Server utilizing the Hyperic scripting client. Basically it’s just a bat file that accepts varies args to manage tc server.

My undeploy task currently looks like:

task undeploy (type: Exec) {

workingDir ‘D:\ci_wars’

executable “cmd”

args “/d”, “D:\ProgramFiles\springsource-tcserver-scripting-client\bin\tcsadmin.bat”, “undeploy-application”, “–host=hyperic”, “–user=jenkins”, “–password=jenkinsPw”, “–secure=True”, “–groupname=tc-test”, “–application=MyApp” }

In the console I see the following for this task:

09:14:12.773 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ‘:undeploy’. 09:14:12.773 [INFO] [org.gradle.process.internal.DefaultExecHandle] Starting process ‘command ‘cmd’’. Working directory: D:\ci_wars Command: cmd /d D:\ProgramFiles\springsource-tcserver-scripting-client\bin\tcsadmin.bat undeploy-application --host=hyperic --user=jenkins --password=jenkinsPw --secure=True --groupname=esp-tst --application=MyApp … 09:14:12.789 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING 09:14:12.789 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: command ‘cmd’. 09:14:12.820 [INFO] [org.gradle.process.internal.ProcessParentingInitializer] An attempt to initialize for well behaving parent process finished. 09:14:12.820 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTED 09:14:12.820 [DEBUG] [org.gradle.process.internal.ExecHandleRunner] waiting until streams are handled… 09:14:12.820 [INFO] [org.gradle.process.internal.DefaultExecHandle] Successfully started process ‘command ‘cmd’’ 09:14:12.836 [QUIET] [system.out] Microsoft Windows [Version 6.1.7601] 09:14:12.836 [QUIET] [system.out] Copyright © 2009 Microsoft Corporation. All rights reserved. 09:14:12.836 [QUIET] [system.out]

09:14:12.836 [QUIET] [system.out] D:\ci_wars> 09:14:12.836 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: SUCCEEDED 09:14:12.836 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process ‘command ‘cmd’’ finished with exit value 0 (state: SUCCEEDED) 09:14:12.836 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ‘:undeploy’

After the above runs, when I check the deployed apps in the Hyperic UI, “MyApp” is still there. But if I copy the full command (as shown towards the top of the log above) and paste that into a cmd window (this is running on Windows server) it runs fine, removing the war as expected and showing the output “Command undeploy-application executed successfully”. I’m guessing there’s an issue with the syntax of my executable task, but I’ve tried every permutation I can think of to no avail. Any help would be much appreciated!


(Peter Niederwieser) #2

I don’t see anything wrong with the Gradle syntax. Isn’t it ‘Program Files’ with a space in between?


(dmolineu) #3

Thanks for the quick reply! ProgramFiles on the D: drive intentionally doesn’t have a space. However I just found that changing “/d” to “/c” enabled it to run correctly. I can’t believe how much time I’ve spent on this and didn’t notice that!