closure.py: Use temporary file names but manual deletion.

Ok Windows+python 2.4
This commit is contained in:
Xavier Mamano
2011-11-12 16:47:57 +01:00
parent 18b23e944d
commit e2c3253108

View File

@@ -8,13 +8,14 @@ if not os.path.exists(path):
def minimize(code):
ntf = tempfile.NamedTemporaryFile()
ntf.write(code)
ntf.flush()
ntf.close()
open(ntf.name, "w").write(code)
ntf2 = tempfile.NamedTemporaryFile()
ntf2.close()
os.system("java -jar %s --js %s --js_output_file %s" % (path, ntf.name, ntf2.name))
data = open(ntf2.name).read()
ntf.close()
ntf2.close()
os.unlink(ntf.name)
os.unlink(ntf2.name)
return data