mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-16 08:13:30 +00:00
Updated self test, and fixed Zenity issue with UTF8
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -919,6 +919,7 @@ function testFileDownload()
|
|||||||
{
|
{
|
||||||
this.end();
|
this.end();
|
||||||
this.ret._rej(' -> File Transfer (Download).........[CRC FAILED]');
|
this.ret._rej(' -> File Transfer (Download).........[CRC FAILED]');
|
||||||
|
console.log(' -> CRC=' + this.crc + ' , expected: ' + global.testbufferCRC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -400,7 +400,6 @@ function linux_messageBox()
|
|||||||
parms.push('--text=' + caption);
|
parms.push('--text=' + caption);
|
||||||
parms.push('--no-wrap');
|
parms.push('--no-wrap');
|
||||||
if (this.zenity.timeout) { parms.push('--timeout=' + timeout); }
|
if (this.zenity.timeout) { parms.push('--timeout=' + timeout); }
|
||||||
|
|
||||||
ret.child = require('child_process').execFile(this.zenity.path, parms, { uid: uid, env: { XAUTHORITY: xinfo.xauthority ? xinfo.xauthority : "", DISPLAY: xinfo.display } });
|
ret.child = require('child_process').execFile(this.zenity.path, parms, { uid: uid, env: { XAUTHORITY: xinfo.xauthority ? xinfo.xauthority : "", DISPLAY: xinfo.display } });
|
||||||
if (this.zenity.timeout)
|
if (this.zenity.timeout)
|
||||||
{
|
{
|
||||||
@@ -419,6 +418,8 @@ function linux_messageBox()
|
|||||||
ret.child.on('exit', function (code)
|
ret.child.on('exit', function (code)
|
||||||
{
|
{
|
||||||
if (this.timeout) { clearTimeout(this.timeout); }
|
if (this.timeout) { clearTimeout(this.timeout); }
|
||||||
|
if (!(this.stderr.str.includes('option is not') && this.promise._options.zenity.timeout))
|
||||||
|
{
|
||||||
if (Array.isArray(this.promise._options.layout))
|
if (Array.isArray(this.promise._options.layout))
|
||||||
{
|
{
|
||||||
if (code == 0 && ((process.platform == 'freebsd' && this.stdout.ostr.trim() == '') || process.platform != 'freebsd'))
|
if (code == 0 && ((process.platform == 'freebsd' && this.stdout.ostr.trim() == '') || process.platform != 'freebsd'))
|
||||||
@@ -439,6 +440,7 @@ function linux_messageBox()
|
|||||||
this.promise._rej('timeout');
|
this.promise._rej('timeout');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@@ -458,16 +460,55 @@ function linux_messageBox()
|
|||||||
this.promise._ch.stdout.str = ''; this.promise._ch.stdout.on('data', function (c)
|
this.promise._ch.stdout.str = ''; this.promise._ch.stdout.on('data', function (c)
|
||||||
{
|
{
|
||||||
this.str += c.toString();
|
this.str += c.toString();
|
||||||
|
if (Array.isArray(layout))
|
||||||
|
{
|
||||||
|
var i;
|
||||||
|
var tmp = c.toString().trim();
|
||||||
|
for (i = 0; i < layout.length; ++i)
|
||||||
|
{
|
||||||
|
if(layout[i] == tmp)
|
||||||
|
{
|
||||||
|
this.parent.result = tmp;
|
||||||
|
//this.parent.promise._res(tmp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (this.str.includes('<<<<$_RESULT>>>>')) { this.str = this.str.split('<<<<$_RESULT>>>>')[1]; }
|
if (this.str.includes('<<<<$_RESULT>>>>')) { this.str = this.str.split('<<<<$_RESULT>>>>')[1]; }
|
||||||
if (this.str.includes('>>>>')) { this.parent.kill(); }
|
if (this.str.includes('>>>>')) { this.parent.kill(); }
|
||||||
});
|
});
|
||||||
this.promise._ch.stdin.write('su - ' + uname + '\n');
|
this.promise._ch.stdin.write('su - ' + uname + '\n');
|
||||||
this.promise._ch.stdin.write('export DISPLAY=' + xinfo.display + '\n');
|
this.promise._ch.stdin.write('export DISPLAY=' + xinfo.display + '\n');
|
||||||
this.promise._ch.stdin.write('zenity ' + (this.promise._options.layout == null ? '--question' : '--warning'));
|
this.promise._ch.stdin.write('zenity ');
|
||||||
|
if (Array.isArray(layout))
|
||||||
|
{
|
||||||
|
var i;
|
||||||
|
this.promise._ch.stdin.write('--info');
|
||||||
|
for (i = 0; i < layout.length; ++i)
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
this.promise._ch.stdin.write(' --ok-label=' + layout[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.promise._ch.stdin.write(' --extra-button=' + layout[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.promise._ch.stdin.write((this.promise._options.layout == null ? '--question' : '--warning'));
|
||||||
|
}
|
||||||
this.promise._ch.stdin.write(' --title=' + this.promise._options.title + ' --text=' + this.promise._options.caption);
|
this.promise._ch.stdin.write(' --title=' + this.promise._options.title + ' --text=' + this.promise._options.caption);
|
||||||
this.promise._ch.stdin.write(' --timeout=' + this.promise._options.timeout + '\nexport _RESULT=$?\necho "<<<<$_RESULT>>>>"\nexit');
|
this.promise._ch.stdin.write(' --timeout=' + this.promise._options.timeout + '\nexport _RESULT=$?\necho "<<<<$_RESULT>>>>"\nexit');
|
||||||
this.promise._ch.on('exit', function ()
|
this.promise._ch.on('exit', function ()
|
||||||
{
|
{
|
||||||
|
if (this.result != null)
|
||||||
|
{
|
||||||
|
this.promise._res(this.result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
var res = this.stdout.str.split('>>>>')[0].split('<<<<')[1];
|
var res = this.stdout.str.split('>>>>')[0].split('<<<<')[1];
|
||||||
switch(parseInt(res))
|
switch(parseInt(res))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user