Commit aaee1832 authored by antoor's avatar antoor

Delete command cache function

删除命令执行缓存功能
parent 64440cc3
...@@ -136,14 +136,15 @@ class Terminal { ...@@ -136,14 +136,15 @@ class Terminal {
if (cmd === 'exit' || cmd === 'quit') { return this.cell.close() }; if (cmd === 'exit' || cmd === 'quit') { return this.cell.close() };
term.pause(); term.pause();
// 是否有缓存 // 是否有缓存
let cacheTag = 'command-' + new Buffer(this.path + cmd).toString('base64'); // 最后想了想,这个命令执行结果的缓存还是暂时不需要了吧
let cacheCmd; // let cacheTag = 'command-' + new Buffer(this.path + cmd).toString('base64');
if (cacheCmd = this.cache.get(cacheTag)) { // let cacheCmd;
term.echo( // if (cacheCmd = this.cache.get(cacheTag)) {
antSword.noxss(cacheCmd) // term.echo(
); // antSword.noxss(cacheCmd, false)
return term.resume(); // );
}; // return term.resume();
// };
// 开始执行命令 // 开始执行命令
this.core.request( this.core.request(
...@@ -175,7 +176,7 @@ class Terminal { ...@@ -175,7 +176,7 @@ class Terminal {
}); });
if (output.length > 0) { if (output.length > 0) {
term.echo( term.echo(
antSword.noxss(output) antSword.noxss(output, false)
); );
// 保存最大100kb数据 // 保存最大100kb数据
if (output.length < (1024 * 1024)) { if (output.length < (1024 * 1024)) {
...@@ -183,8 +184,8 @@ class Terminal { ...@@ -183,8 +184,8 @@ class Terminal {
}; };
}; };
term.resume(); term.resume();
}).catch((e) => { }).catch((_) => {
term.error('ERR: ' + (_ instanceof Object) ? JSON.stringify(_) : String(_)); // term.error('ERR: ' + (_ instanceof Object) ? JSON.stringify(_) : String(_));
term.resume(); term.resume();
}); });
}, { }, {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment