Added Windows catch

This commit is contained in:
lukeroge 2012-03-29 21:12:41 +13:00
parent 7b21ffe065
commit 17a4d8262c

View file

@ -2,6 +2,7 @@
from util import hook from util import hook
import subprocess import subprocess
import re import re
import os
ping_regex = re.compile(r"(\d+.\d+)/(\d+.\d+)/(\d+.\d+)/(\d+.\d+)") ping_regex = re.compile(r"(\d+.\d+)/(\d+.\d+)/(\d+.\d+)/(\d+.\d+)")
@ -10,9 +11,13 @@ ping_regex = re.compile(r"(\d+.\d+)/(\d+.\d+)/(\d+.\d+)/(\d+.\d+)")
def ping(inp, reply=None): def ping(inp, reply=None):
".ping <host> [count] -- Pings <host> [count] times." ".ping <host> [count] -- Pings <host> [count] times."
if os.name == "nt":
return "Sorry, this command is not supported on Windows systems."
args = inp.split(' ') args = inp.split(' ')
host = args[0] host = args[0]
# check for a seccond argument and set the ping count
if len(args) > 1: if len(args) > 1:
count = int(args[1]) count = int(args[1])
if count > 20: if count > 20: