summaryrefslogtreecommitdiff
path: root/modules/changes
diff options
context:
space:
mode:
Diffstat (limited to 'modules/changes')
-rw-r--r--modules/changes/changes.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/changes/changes.js b/modules/changes/changes.js
index 8a0b3d9..3c75671 100644
--- a/modules/changes/changes.js
+++ b/modules/changes/changes.js
@@ -436,12 +436,21 @@ module.exports=function(app,io,_moddir){
}
counter++;
if(counter<2)return;
+
var proc=child_process.spawn(
"diff",
[folder+"/old.html",folder+"/new.html"],
{stdio:[process.stdin,fs.openSync(folder+"/diff.txt","w"),process.stderr]});
+
proc.on("exit",function(code,signal){
- fs.createReadStream(folder+"/diff.txt").pipe(res);
+ var stream=fs.createReadStream(folder+"/diff.txt");
+ stream.pipe(res);
+ stream.on("end",function(){
+ fs.unlinkSync(folder+"/old.html");
+ fs.unlinkSync(folder+"/new.html");
+ fs.unlinkSync(folder+"/diff.txt");
+ fs.rmdirSync(folder);
+ });
});
};
fs.writeFile(folder+"/old.html",tl[oldi][2],fscb);