I have a super simple task I need Jenkins to do for me: Run the executable that was compiled, by Jenkins, after building.
Sounds simple.
However, no matter what I've tried in the past half a day will run the program, correctly. Currently, the absolute best I can get, is a blank output of running the executable, which is Never what the program does. It always has output when run.
I've tried downloading the entire workspace related to builds, and running the executable locally, and it works fine - I get output. I went to the slave computer that Jenkins has the workspace on, and ran it out of the workspace folder, it runs fine - there is output. When run via Jenkins pipeline - through a variety of methods (here's a few of the many things and variants I've tried) - no output:
echo bat(returnStdout: true, script: "cmd.exe /c program.exe")
echo bat(returnStdout: true, script: "cmd.exe /c programRunner.bat")
echo bat(returnStdout: true, script: "call program.exe")
echo bat(returnStdout: true, script: "call programRunner.bat")
echo bat(returnStdout: true, script: "program.exe")
echo bat(returnStdout: true, script: "programRunner.bat")
NOTE: programRunner.bat simply is calling program.exe in one of the various methods above, but, written appropriately for a .bat file. When run manually it has expected output, like program.exe. But when run via Jenkins, there's no output.
All of these, do not report errors (when replaced with the actual name of the program) - so it's not that the file is missing. I've tried adding a random character to the name, and it errors because it cannot find that file (because it's a made up file name). SO, it is finding the file, and actually trying to run. But, there's absolutely no output... I've tried piping the output to a file (> ..\..\programOutput.txt 2>&1
), and it's a blank but created file in the end.
I suspect it thinks it is missing some dependency. But, I don't understand why I can run it fine locally and on the slave machine manually, to get expected output. It has the dependencies it needs in the same folder as the executable (this is a step in the build process we have, to copy all .dll
s needed).
Any help would be greatly appreciated. Let me know if you need clarification on anything.
Again, this sounds simple, and should be, but I'm having the hardest time. I'm not really sure what to try next to be honest. I get no output! It's super hard to debug with no output...