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,24 +42,7 @@ 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
|
|
||||||
child = require('child_process').execFile('/bin/sh', ['sh']);
|
|
||||||
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
|
||||||
child.stderr.on('data', function () { });
|
|
||||||
child.stdin.write('ls /lib/' + libname + '.*' + " | tr '\\n' '`' | awk -F'`' '{" + ' DEL=""; printf "["; for(i=1;i<NF;++i) { if($1~/((.so)(.[0-9]+)*)$/) { printf "%s{\\"path\\": \\"%s\\"}",DEL,$i; DEL=","; } } printf "]"; }\'\nexit\n');
|
|
||||||
child.waitExit();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return(JSON.parse(child.stdout.str.trim()));
|
|
||||||
}
|
|
||||||
catch(e)
|
|
||||||
{
|
|
||||||
return ([]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
var ldconfig = child.stdout.str.trim();
|
var ldconfig = child.stdout.str.trim();
|
||||||
child = require('child_process').execFile('/bin/sh', ['sh']);
|
child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||||
@@ -71,13 +54,27 @@ function getLibInfo(libname)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var v = JSON.parse(child.stdout.str.trim());
|
var v = JSON.parse(child.stdout.str.trim());
|
||||||
return (v);
|
if (v.length != 0) { return (v); }
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
return ([]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No ldconfig, or no result returned;
|
||||||
|
child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||||
|
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
||||||
|
child.stderr.on('data', function () { });
|
||||||
|
child.stdin.write('ls /lib/' + libname + '.*' + " | tr '\\n' '`' | awk -F'`' '{" + ' DEL=""; printf "["; for(i=1;i<NF;++i) { if($1~/((.so)(.[0-9]+)*)$/) { printf "%s{\\"path\\": \\"%s\\"}",DEL,$i; DEL=","; } } printf "]"; }\'\nexit\n');
|
||||||
|
child.waitExit();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return (JSON.parse(child.stdout.str.trim()));
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
return ([]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function monitorinfo()
|
function monitorinfo()
|
||||||
|
|||||||
Reference in New Issue
Block a user