thombashi / pingparsing

pingparsing is a CLI-tool/Python-library parser and transmitter for ping command :arrow_right_hook:
https://pingparsing.rtfd.io/
MIT License
78 stars 10 forks source link

waittime behavior #21

Closed toddjames closed 7 years ago

toddjames commented 7 years ago

Thanks for all of the effort you've put into this library. It's the only one that I've found to be actively developed and work well.

There is a bug with respect to either the logic or exception message for waittime in the PingTransmitter class:

       if self.waittime <= 0:
            raise ValueError(
                "wait time must be greater than or equal to zero")

When waittime is set to 0, the exception is raised, which states that the

wait time must be greater than or equal to zero

According to the exception, 0 should be a valid value, but it isn't

More to the point, what prompted me to start digging into this is that I was looking for a way to exclude the use of the -w flag on Linux altogether. I want ping to return as soon as it's done.

As a feature request in addition to the bug above, it would be very helpful to be able to set waittime to 0 and have the -w flag not be passed to ping.

thombashi commented 7 years ago

Thank you for the report.

You are correct.

wait time must be greater than or equal to zero

This error message is incorrect, correctly it should be

wait time must be greater than zero

I've fixed the error message.

As a feature request in addition to the bug above, it would be very helpful to be able to set waittime to 0 and have the -w flag not be passed to ping.

And I add capability to ignore waittime by setting None with pingparsing 0.4.0.

toddjames commented 7 years ago

Works perfectly, thanks!