I have 2 methods within a rake script, both of which use system "<SomeCommand>", one is for calling JSLint with a file, which works fine. One is for calling YUICompressor, which always fails with a 127 error code.
The strange thing is I can call the EXACT command the ruby script is running and it works fine, I pass it a file, and it outputs a minified version. However when I run it thought the ruby script it always bombs…
It basically looks like this:
system java -jar c:/dump/tools/yuicompressor-2.7.4.jar c:/dump/src/input_file.js c:/dump/src/output_file.min.js
I know it looks horrible with all the absolute paths but thats how the build script currently works off absolute paths, but that command works fine if I just invoke it on the command line, however when I run it through Rake/Ruby it just bombs… but the other system call to JSLint works fine, that however calls a batch file via an absolute path…
Cannot find any information on this online, anyone see anything odd in the above?
Just to confirm all the files exist in the relevant positions.
Incase anyone else gets driven mad by the same problem on windows, it seems to be down to the fact that
systemcannot handle the command as one big string, you need to break it up for it into arguments, so here is how I got it working:This above approach works fine.