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

Added ability to close message-box for linux

This commit is contained in:
Bryan Roe
2020-04-28 12:47:58 -07:00
parent 875c5ef2b1
commit 1e10f90aec
2 changed files with 17 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@@ -290,8 +290,8 @@ function linux_messageBox()
ret.child = require('child_process').execFile(this.zenity.path, ['zenity', layout == null ? '--question' : '--warning', '--title=' + title, '--text=' + caption], { uid: uid, env: { XAUTHORITY: xinfo.xauthority ? xinfo.xauthority : "", DISPLAY: xinfo.display } }); ret.child = require('child_process').execFile(this.zenity.path, ['zenity', layout == null ? '--question' : '--warning', '--title=' + title, '--text=' + caption], { uid: uid, env: { XAUTHORITY: xinfo.xauthority ? xinfo.xauthority : "", DISPLAY: xinfo.display } });
ret.child.timeout = setTimeout(function (c) ret.child.timeout = setTimeout(function (c)
{ {
c.promise._rej('timeout');
c.timeout = null; c.timeout = null;
c.promise._rej('timeout');
c.kill(); c.kill();
}, timeout * 1000, ret.child); }, timeout * 1000, ret.child);
} }
@@ -388,6 +388,16 @@ function linux_messageBox()
{ {
ret._rej('Unable to create dialog box'); ret._rej('Unable to create dialog box');
} }
ret.close = function close()
{
if (this.timeout) { clearTimeout(this.timeout); }
if (this.child)
{
this._rej('denied');
this.child.kill();
}
}
return (ret); return (ret);
}; };
} }