1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-24 04:04:31 +00:00

Added try/catch around getLibInfo() to fix an issue on ChromeOS

This commit is contained in:
Bryan Roe
2020-04-08 13:11:39 -07:00
parent ddfce07d40
commit 00b613fcb1
2 changed files with 16 additions and 8 deletions

View File

@@ -46,10 +46,17 @@ function getLibInfo(libname)
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();
var v = JSON.parse(child.stdout.str.trim());
return (v);
try
{
var v = JSON.parse(child.stdout.str.trim());
return (v);
}
catch(e)
{
return ({});
}
}
function monitorinfo()