280north (owner)

Revisions

gist: 226843 Download_button fork
public
Public Clone URL: git://gist.github.com/226843.git
Embed All Files: show embed
Text only #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var compressor = null;
 
function sharedCompressor()
{
    if (!compressor) { print("here...");
        compressor = OS.popen("java -server -Dfile.encoding=UTF-8 -classpath " + RHINO_PATH + ":" + SHRINKSAFE_PATH + " org.dojotoolkit.shrinksafe.Main");print("ok!");
}
    return compressor;
}
 
function compress(/*String*/ aCode, /*String*/ FIXME)
{
    print("called compress: " + aCode.length);
    var tmpFile = FILE.join("/tmp", FIXME + Math.random() + ".tmp");
 
    FILE.write(tmpFile, aCode, { charset:"UTF-8" });
 
    var compressor = sharedCompressor();
        output = "",
        chunk = "";
print("1");
    compressor.stdin.write(tmpFile + "\n");
print("2");
    while (chunk = compressor.stdout.read())
    {
        output += chunk;
        print("x");
    }
    return output;
// return OS.command(["java", "-Dfile.encoding=UTF-8", "-classpath", [RHINO_PATH, SHRINKSAFE_PATH].join(":"), "org.dojotoolkit.shrinksafe.Main", tmpFile]);
}