/*jslint node: true, nomen: true, sloppy: true*/

var cp = require('child_process'),
    fs = require('fs'),
    tests,
    command,
    exitCode = 0;

// Execute requirejs optimizer
cp.exec('node ' + __dirname + '/../vendor/r.js/dist/r.js -o ' + __dirname + '/Classify.build.js', function (error, stdout, stderr) {

    // Print success or error
    if (error !== null) {
        console.error(stderr);
        exitCode = 1;
    } else {
        console.log(stdout);
    }

    // Remove other files
    var files = fs.readdirSync(__dirname + '/../dist'),
        distDir = __dirname + '/../dist/';

    files.forEach(function (file) {

        var code;

        if (file.substr(file.length - 3) === ".js" && file !== "Classify.js") {
            console.log("Deleting " + file);
            code = fs.unlinkSync(distDir + file);

            if (code === 0) {
                exitCode = 1;
            }
        }
    });

    // Exit if something went badly
    if (exitCode) {
        process.exit(exitCode);
    }

    // Run tests
    command = 'mocha -R list ' + __dirname + '/../test/Classify.test.js';

    if (process.platform === 'win32') {
        tests = cp.spawn('cmd', ['/s', '/c', command], { customFds: [0, 1, 2] });
    } else {
        tests = cp.spawn('sh', ['-c', command], { customFds: [0, 1, 2] });
    }
    tests.on('exit', function (code) {

        if (code !== 0) {
            process.exit(1);
        } else {
            process.exit(0);
        }
    });
});
@@ -699,13 +699,13 @@
 === 
-%22.js%22
+'.js'
  && 
@@ -713,17 +713,17 @@
 ile !== 
-%22
+'
 Classify
@@ -725,17 +725,17 @@
 ssify.js
-%22
+'
 ) %7B%0A    
@@ -754,17 +754,17 @@
 ole.log(
-%22
+'
 Deleting
@@ -768,9 +768,9 @@
 ing 
-%22
+'
  + f
@@ -848,32 +848,89 @@
  (code === 0) %7B%0A
+                console.error('Unable to delete file.');%0A
                 

Add error message and fix CS.