Avoid generating random variable names for functions executed in parallel shell

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Trivial - P5
    • 3.3.0
    • Affects Version/s: None
    • Component/s: Testing Infrastructure
    • None
    • Fully Compatible
    • TIG E (01/08/16)
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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() { ... })().

            Assignee:
            Jonathan Abrahams (Inactive)
            Reporter:
            Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: