From 0d1ad777daf25ef415bf45032d41b587baf20781 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 1 Aug 2021 10:41:02 +0200 Subject: ping: T3707: add UnicodeError exception when invalid IP address is passed --- src/op_mode/ping.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/op_mode/ping.py b/src/op_mode/ping.py index 924a889db..610f6a05d 100755 --- a/src/op_mode/ping.py +++ b/src/op_mode/ping.py @@ -220,6 +220,8 @@ if __name__ == '__main__': try: ip = socket.gethostbyname(host) + except UnicodeError: + sys.exit(f'ping: Unknown host: {host}') except socket.gaierror: ip = host -- cgit v1.2.3