1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-21 10:43:36 +00:00

Fixed structure in identifiers and lib-finder so that objects get GC faster

This commit is contained in:
Bryan Roe
2022-09-16 20:51:56 -07:00
parent e0044984e5
commit ce6f57af42
3 changed files with 39 additions and 17 deletions

View File

@@ -54,7 +54,9 @@ function hasBinary(bin)
child.stdout.on('data', function (c) { this.str += c.toString(); });
child.stdin.write("whereis " + bin + " | awk '{ print $2 }'\nexit\n");
child.waitExit();
return (child.stdout.str.trim() != '');
var ret = child.stdout.str.trim() != '';
child = null;
return (ret);
}
function findBinary(bin)
{
@@ -64,7 +66,9 @@ function findBinary(bin)
child.stdout.on('data', function (c) { this.str += c.toString(); });
child.stdin.write("whereis " + bin + " | awk '{ print $2 }'\nexit\n");
child.waitExit();
return (child.stdout.str.trim()!=""?child.stdout.str.trim():null);
var ret = child.stdout.str.trim() != "" ? child.stdout.str.trim() : null;
child = null;
return (ret);
}
module.exports = find;