Created
November 5, 2009 07:12
-
-
Save cappuccino/226843 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment