diff --git a/libpathod/cmdline.py b/libpathod/cmdline.py index a21fa2187..f80b7aaef 100644 --- a/libpathod/cmdline.py +++ b/libpathod/cmdline.py @@ -36,7 +36,7 @@ def go_pathoc(): ) parser.add_argument( "-n", dest='repeat', default=1, type=int, metavar="N", - help='Repeat N times' + help='Repeat N times. If 0 repeat for ever.' ) parser.add_argument( "-r", dest="random", action="store_true", default=False, diff --git a/libpathod/pathoc.py b/libpathod/pathoc.py index c85c207a2..02d0c06d5 100644 --- a/libpathod/pathoc.py +++ b/libpathod/pathoc.py @@ -224,7 +224,9 @@ class Pathoc(tcp.TCPClient): def main(args): try: - for i in range(args.repeat): + cnt = 0 + while 1: + cnt += 1 p = Pathoc( (args.host, args.port), ssl=args.ssl, @@ -258,5 +260,7 @@ def main(args): sys.stdout.flush() if ret and args.oneshot: sys.exit(0) + if cnt == args.repeat: + break except KeyboardInterrupt: pass diff --git a/test/test_language.py b/test/test_language.py index b2add1490..0818c587f 100644 --- a/test/test_language.py +++ b/test/test_language.py @@ -696,7 +696,9 @@ class TestResponse: testlen(r) def test_parse_err(self): - tutils.raises(language.ParseException, language.parse_response, "400:msg,b:") + tutils.raises( + language.ParseException, language.parse_response, "400:msg,b:" + ) try: language.parse_response("400'msg':b:") except language.ParseException, v: