Prerequisites:
Python 2.7.3
Java
nodejs
[grunt](https://github.com/cowboy/grunt) npm install -g grunt
Here is the weirdness grunt works fine if I run it on the command line or if I put it into a batch file and run that manually. But if I put either into Action: “Run DOS Command / Batch File”, or the Action:“Execute Program”. I get the below error message. Now what’s curious about the error is that the tmp%GUID%.stdout does not exist, and it’s clear that the file is a Finalbuilder tmp file.
Error Message:
C:\Projects\trunk\MMWebHTML\mj\viewer>grunt.cmd
[4mRunning “gloablize” task[24m
Error: ENOENT, no such file or directory ‘C:\Users\BUILD~1.MIN\AppData\Local\Temp\2\tmp1349893925353005205364874564111.stdout’
at Object.fs.openSync (fs.js:338:18)
at Object.fs.readFileSync (fs.js:182:15)
at getOutput (C:\Projects\trunk\MMWebHTML\mj\viewer\node_modules\grunt-steal\node_modules\exec-sync\bin\index.js:39:17)
at module.exports (C:\Projects\trunk\MMWebHTML\mj\viewer\node_modules\grunt-steal\node_modules\exec-sync\bin\index.js:59:14)
at Object.module.exports (C:\Projects\trunk\MMWebHTML\mj\viewer\node_modules\grunt-steal\tasks\steal.js:31:20)
at Object.task.registerTask.thisTask.fn (C:\Users\build.MINDJETQA\AppData\Roaming\npm\node_modules\grunt\lib\grunt\task.js:58:16)
at Task. (C:\Users\build.MINDJETQA\AppData\Roaming\npm\node_modules\grunt\lib\util\task.js:341:36)
at Task. (C:\Users\build.MINDJETQA\AppData\Roaming\npm\node_modules\grunt\lib\util\task.js:317:9)
at Task. (C:\Users\build.MINDJETQA\AppData\Roaming\npm\node_modules\grunt\lib\util\task.js:344:11)
at Task. (C:\Users\build.MINDJETQA\AppData\Roaming\npm\node_modules\grunt\lib\util\task.js:317:9)
Program returned code : 1
So I also tried this on Jenkins with similar results. After talking to support I’m left with a problem I don’t know how to address. Apparently grunt can not be redirected through cmd.
So Final Builder (and Jenkins) creates a wrapper bat file and then pipes that into cmd. For whatever reason this action is causing the process to blow up. Which leads up the creek for possible solutions.
If you use the Execute Program action, it does not create a wrapper bat. A .cmd file is a batch file, and should be executed using the Run Dos Command action, which invokes the command interpreter (cmd.exe) and passes it the batch file. Did you try that?
I had tried using calling node.exe with the grunt as the parameter. But calling cmd directly is a good suggestion. Of course I get very similar error output.
[4mRunning “gloablize” task[24m
Error: ENOENT, no such file or directory ‘C:\Users\BUILD~1.MIN\AppData\Local\Temp\2\tmp1351027883012008680653204210103.stdout’
at Object.fs.openSync (fs.js:338:18)
at Object.fs.readFileSync (fs.js:182:15)
at getOutput (C:\Projects\trunk\MMWebHTML\mj\viewer\node_modules\grunt-steal\node_modules\exec-sync\bin\index.js:39:17)
at module.exports (C:\Projects\trunk\MMWebHTML\mj\viewer\node_modules\grunt-steal\node_modules\exec-sync\bin\index.js:59:14)
at Object.module.exports (C:\Projects\trunk\MMWebHTML\mj\viewer\node_modules\grunt-steal\tasks\steal.js:31:20)
at Object.task.registerTask.thisTask.fn (C:\Users\build.MINDJETQA\AppData\Roaming\npm\node_modules\grunt\lib\grunt\task.js:58:16)
at Task. (C:\Users\build.DOMAIN\AppData\Roaming\npm\node_modules\grunt\lib\util\task.js:341:36)
at Task. (C:\Users\build.DOMAIN\AppData\Roaming\npm\node_modules\grunt\lib\util\task.js:317:9)
at Task. (C:\Users\build.DOMAIN\AppData\Roaming\npm\node_modules\grunt\lib\util\task.js:344:11)
at Task. (C:\Users\build.DOMAIN\AppData\Roaming\npm\node_modules\grunt\lib\util\task.js:317:9)
Program returned code : 1
Ok I got calling cmd to work but I’m puzzled on how to convert this into a final builder action.
cmd /c “cd C:\working\directory\without\spaces && grunt.bat” Gets it to create the expected out put.
However when I set this up as a Final builder action it fails spectacularly.
Execute Program
Program File: cmd.exe
Parameters: /C grunt.bat
Start In: C:\working\directory\without\space