1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-16 00:03:45 +00:00

Updated xclip clipboard, to so xclip cleanup occurs if process exits before xclip timeout

This commit is contained in:
Bryan Roe
2020-06-08 14:40:00 -07:00
parent 628e44121a
commit e448456d9e
2 changed files with 47 additions and 36 deletions

File diff suppressed because one or more lines are too long

View File

@@ -316,9 +316,7 @@ function lin_xclip_copy(txt)
ret.child.promise = ret;
ret.child.stderr.on('data', function (c) { console.log(c.toString()); });
ret.child.stdout.on('data', function (c) { console.log(c.toString()); });
ret.child.on('exit', function ()
{
xclipTable[this.promise._hashCode()] = setTimeout(function (p)
ret.child._cleanup = function _cleanup(p)
{
var ch = require('child_process').execFile('/bin/sh', ['sh']);
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');
}
delete xclipTable[p._hashCode()];
};
ret.child.on('exit', function ()
{
xclipTable[this.promise._hashCode()] = setTimeout(function (p)
{
p.child._cleanup(p);
}, 20000, this.promise);
this.promise._res();
});
@@ -358,6 +362,13 @@ function lin_xclip_copy(txt)
{
this.end();
});
ret.child.on('~', function ()
{
if (xclipTable[this.promise._hashCode()])
{
this._cleanup(this.promise);
}
});
return (ret);
}