mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-15 15:53:55 +00:00
Changed order of operation for getLibInfo()
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -42,9 +42,26 @@ function getLibInfo(libname)
|
|||||||
child.stdin.write("whereis ldconfig | awk '{ print $2 }'\nexit\n");
|
child.stdin.write("whereis ldconfig | awk '{ print $2 }'\nexit\n");
|
||||||
child.waitExit();
|
child.waitExit();
|
||||||
|
|
||||||
if (child.stdout.str.trim() == '')
|
if (child.stdout.str.trim() != '')
|
||||||
{
|
{
|
||||||
// No ldconfig
|
var ldconfig = child.stdout.str.trim();
|
||||||
|
child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||||
|
child.stdout.str = '';
|
||||||
|
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
|
||||||
|
child.stdin.write(ldconfig + " -p | grep '" + libname + ".so.' | tr '\\n' '^' | awk -F^ '{ printf \"[\"; for(i=1;i<=NF;++i) {" + ' split($i, plat, ")"); split(plat[1], plat2, "("); ifox=split(plat2[2], ifo, ","); libc=""; hwcap="0"; for(ifoi=1;ifoi<=ifox;++ifoi) { if(split(ifo[ifoi], jnk, "libc")==2) { libc=ifo[ifoi]; } if(split(ifo[ifoi], jnk, "hwcap:")==2) { split(ifo[ifoi], jnk, "0x"); hwcap=jnk[2]; } } x=split($i, tok, " "); if(tok[1]!="") { printf "%s{\\"lib\\": \\"%s\\", \\"path\\": \\"%s\\", \\"hwcap\\": \\"%s\\", \\"libc\\": \\"%s\\"}", (i!=1?",":""), tok[1], tok[x], hwcap, libc; }} printf "]"; }\'\nexit\n');
|
||||||
|
child.waitExit();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var v = JSON.parse(child.stdout.str.trim());
|
||||||
|
if (v.length != 0) { return (v); }
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No ldconfig, or no result returned;
|
||||||
child = require('child_process').execFile('/bin/sh', ['sh']);
|
child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||||
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
||||||
child.stderr.on('data', function () { });
|
child.stderr.on('data', function () { });
|
||||||
@@ -59,26 +76,6 @@ function getLibInfo(libname)
|
|||||||
return ([]);
|
return ([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
var ldconfig = child.stdout.str.trim();
|
|
||||||
child = require('child_process').execFile('/bin/sh', ['sh']);
|
|
||||||
child.stdout.str = '';
|
|
||||||
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
|
|
||||||
child.stdin.write(ldconfig + " -p | grep '" + libname + ".so.' | tr '\\n' '^' | awk -F^ '{ printf \"[\"; for(i=1;i<=NF;++i) {" + ' split($i, plat, ")"); split(plat[1], plat2, "("); ifox=split(plat2[2], ifo, ","); libc=""; hwcap="0"; for(ifoi=1;ifoi<=ifox;++ifoi) { if(split(ifo[ifoi], jnk, "libc")==2) { libc=ifo[ifoi]; } if(split(ifo[ifoi], jnk, "hwcap:")==2) { split(ifo[ifoi], jnk, "0x"); hwcap=jnk[2]; } } x=split($i, tok, " "); if(tok[1]!="") { printf "%s{\\"lib\\": \\"%s\\", \\"path\\": \\"%s\\", \\"hwcap\\": \\"%s\\", \\"libc\\": \\"%s\\"}", (i!=1?",":""), tok[1], tok[x], hwcap, libc; }} printf "]"; }\'\nexit\n');
|
|
||||||
child.waitExit();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var v = JSON.parse(child.stdout.str.trim());
|
|
||||||
return (v);
|
|
||||||
}
|
|
||||||
catch (e)
|
|
||||||
{
|
|
||||||
return ([]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function monitorinfo()
|
function monitorinfo()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user