Details
-
Task
-
Resolution: Done
-
Trivial - P5
-
None
-
None
-
Fully Compatible
-
TIG E (01/08/16)
Description
Passing a function to startParallelShell() unnecessarily introduces a variable into the started shell's scope (using random numbers to avoid a collision).
if (typeof(jsCode) == "function") {
|
var id = Math.floor(Math.random() * 100000);
|
jsCode = "var f" + id + " = " + jsCode.toString() + ";f" + id + "();";
|
}
|
Instead we can have jsCode immediately invoke the function expression, i.e.
startParallelShell(function() { ... }) becomes --eval (function() { ... })().