When I run your script, the error "* Invalid parameters: $com" is reported when a second call to "ReadLine" is made with a parameter at the line:
echo line2: $exec(%testcom).readline = $true Microsoft Windows [Version 6.1.7601]
So I have not been able to reproduce the issue here yet.