node-traceroute icon indicating copy to clipboard operation
node-traceroute copied to clipboard

Error on windows (variable scope)

Open Devidian opened this issue 9 years ago • 0 comments

I just tried to use your wrapper and got an error (solved it by myself, just for you to correct) See this code:

    if (internals.isWin) {
        for (let i = 0; i < lines.length; ++i) {
            if (/^\s+1/.test(lines[i])) {
                break;
            }
        }
        lines.splice(0,i);
        lines.pop();
        lines.pop();
    }

"let i" scope is only in the for loop and cant be accessed in lines.splice. Exchange let with var solves the problem Maybe lines.length instead of i would do it too i think

Devidian avatar Apr 27 '16 10:04 Devidian