Skip to content
uupaa edited this page Oct 4, 2014 · 1 revision

Compile.exec

Compile.exec(input:PathString, output:PathString, options:String, callback:Function):void は、Closure Compiler に渡すコマンドラインを作成、Closure Compiler を実行し、結果を受け取って callback(err, stdout, stderr):void を呼び出します。

function Compile_exec(input,      // @arg PathString
                      output,     // @arg PathString
                      options,    // @arg String
                      callback) { // @arg Function - callback(err, stdout, stderr):void
    var jar = path.join(__dirname, 'vendor/compiler.jar');

    var command = "java -jar " + jar +
                  " --js_output_file " + output +
                  " --js " + input +
                  " "  + options;

    childProcess.exec(command, function(err, stdout, stderr) {
        callback(err, stdout, stderr);
    });
}

Clone this wiki locally