Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
aaee1832
Commit
aaee1832
authored
Jun 01, 2016
by
antoor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete command cache function
删除命令执行缓存功能
parent
64440cc3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
index.js
source/modules/terminal/index.js
+12
-11
No files found.
source/modules/terminal/index.js
View file @
aaee1832
...
@@ -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
();
});
});
},
{
},
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment