mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-25 21:53:14 -05:00
Added cancel() support to File Search
This commit is contained in:
parent
9bebca7b97
commit
7386a3f8c2
@ -2221,6 +2221,8 @@ function createMeshCore(agent) {
|
|||||||
case 'findfile': {
|
case 'findfile': {
|
||||||
// Search for files
|
// Search for files
|
||||||
var r = require('file-search').find(cmd.path, cmd.filter);
|
var r = require('file-search').find(cmd.path, cmd.filter);
|
||||||
|
if (!r.cancel) { r.cancel = function cancel() { this.child.kill(); }; }
|
||||||
|
this._search = r;
|
||||||
r.socket = this;
|
r.socket = this;
|
||||||
r.socket.reqid = cmd.reqid; // Search request id. This is used to send responses and cancel the request.
|
r.socket.reqid = cmd.reqid; // Search request id. This is used to send responses and cancel the request.
|
||||||
r.socket.path = cmd.path; // Search path
|
r.socket.path = cmd.path; // Search path
|
||||||
@ -2229,9 +2231,11 @@ function createMeshCore(agent) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'cancelfindfile': {
|
case 'cancelfindfile': {
|
||||||
// TODO: Cancel a search for files
|
if (this._search)
|
||||||
// cmd.reqid <-- Cancel this reqid
|
{
|
||||||
sendConsoleText('cancelfindfile: ' + cmd.reqid);
|
this._search.cancel();
|
||||||
|
this._search = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case 'download': {
|
case 'download': {
|
||||||
// Download a file
|
// Download a file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user