Closed davidgoitia closed 1 year ago
@davidgoitia Thank you for this PR. It helped me understand the bug, which was hidden here since day one and became "active" once I removed the if (m === undefined)
. Reading from the array in spite of it being empty caused a bunch of undefined
values to be fed to the vbscript.
However, I chose to fix this in a different manner, which is to change write
from:
function write(m) {
var b = module.exports.encode(m)
debug(b)
return stream.write(b)
}
to
function write(m) {
var b = module.exports.encode(m)
debug(b)
return stream.write(b) && arr.length > 0
}
I'm very sorry I'm rejecting your PR but it's important that you know that your time was not wasted, because you found the problem.
Also my sincere apologies to everyone for taking so long to address this. Just didn't have a lot of free time for a few months now.
Will published fixed version shortly
This issue was caused by the fix attempt in #48 which prevented the loop from finishing.
Using an index instead of pop allows to control array positioning even through drain event and allows undefined items in the array. Also prevents popping items from an array that could be reused in the caller.