mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-19 17:53:28 +00:00
Updated xclip clipboard, to so xclip cleanup occurs if process exits before xclip timeout
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -316,9 +316,7 @@ function lin_xclip_copy(txt)
|
|||||||
ret.child.promise = ret;
|
ret.child.promise = ret;
|
||||||
ret.child.stderr.on('data', function (c) { console.log(c.toString()); });
|
ret.child.stderr.on('data', function (c) { console.log(c.toString()); });
|
||||||
ret.child.stdout.on('data', function (c) { console.log(c.toString()); });
|
ret.child.stdout.on('data', function (c) { console.log(c.toString()); });
|
||||||
ret.child.on('exit', function ()
|
ret.child._cleanup = function _cleanup(p)
|
||||||
{
|
|
||||||
xclipTable[this.promise._hashCode()] = setTimeout(function (p)
|
|
||||||
{
|
{
|
||||||
var ch = require('child_process').execFile('/bin/sh', ['sh']);
|
var ch = require('child_process').execFile('/bin/sh', ['sh']);
|
||||||
ch.stdout.str = ''; ch.stdout.on('data', function (c) { this.str += c.toString(); });
|
ch.stdout.str = ''; ch.stdout.on('data', function (c) { this.str += c.toString(); });
|
||||||
@@ -351,6 +349,12 @@ function lin_xclip_copy(txt)
|
|||||||
process.kill(parseInt(ch.stdout.str), 'SIGKILL');
|
process.kill(parseInt(ch.stdout.str), 'SIGKILL');
|
||||||
}
|
}
|
||||||
delete xclipTable[p._hashCode()];
|
delete xclipTable[p._hashCode()];
|
||||||
|
};
|
||||||
|
ret.child.on('exit', function ()
|
||||||
|
{
|
||||||
|
xclipTable[this.promise._hashCode()] = setTimeout(function (p)
|
||||||
|
{
|
||||||
|
p.child._cleanup(p);
|
||||||
}, 20000, this.promise);
|
}, 20000, this.promise);
|
||||||
this.promise._res();
|
this.promise._res();
|
||||||
});
|
});
|
||||||
@@ -358,6 +362,13 @@ function lin_xclip_copy(txt)
|
|||||||
{
|
{
|
||||||
this.end();
|
this.end();
|
||||||
});
|
});
|
||||||
|
ret.child.on('~', function ()
|
||||||
|
{
|
||||||
|
if (xclipTable[this.promise._hashCode()])
|
||||||
|
{
|
||||||
|
this._cleanup(this.promise);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user