Skip to content

Commit

Permalink
Don't fail the build if sending the IRC notification fails
Browse files Browse the repository at this point in the history
  • Loading branch information
jyrkive committed Dec 1, 2016
1 parent 8cfd128 commit 19167ca
Showing 1 changed file with 34 additions and 29 deletions.
63 changes: 34 additions & 29 deletions utils/appveyor/irc-notify.py
Expand Up @@ -129,32 +129,37 @@ def appveyor_vars():
irc_username = 'Appveyor'
irc_nick = irc_username + str(random.randint(1, 9999))

# establish connection
irc_sock = ssl.wrap_socket(socket.socket(socket.AF_INET, socket.SOCK_STREAM))
irc_sock.connect((socket.gethostbyname('chat.freenode.net'), 6697))
irc_sock.send('NICK {0}\r\nUSER {0} * 0 :{0}\r\n'.format(irc_username).encode())
irc_file = irc_sock.makefile()

while irc_file:
line = irc_file.readline()
print(line.rstrip())
response = line.split()

if response[0] == 'PING':
irc_file.send('PONG {}\r\n'.format(reponse[1]).encode())

elif response[1] == '433':
irc_sock.send('NICK {}\r\n'.format(irc_nick).encode())

elif response[1] == '001':
time.sleep(5)
# join the channel
irc_sock.send('JOIN #{}\r\n'.format(channel).encode())
# send messages
for msg in messages:
print('PRIVMSG #{} :{}'.format(channel, msg))
irc_sock.send('PRIVMSG #{} :{}\r\n'.format(channel, msg).encode())
time.sleep(5)
# leave the channel
irc_sock.send('PART #{}\r\n'.format(channel).encode())
sys.exit()
try:
# establish connection
irc_sock = ssl.wrap_socket(socket.socket(socket.AF_INET, socket.SOCK_STREAM))
irc_sock.connect((socket.gethostbyname('chat.freenode.net'), 6697))
irc_sock.send('NICK {0}\r\nUSER {0} * 0 :{0}\r\n'.format(irc_username).encode())
irc_file = irc_sock.makefile()

while irc_file:
line = irc_file.readline()
print(line.rstrip())
response = line.split()

if response[0] == 'PING':
irc_file.send('PONG {}\r\n'.format(reponse[1]).encode())

elif response[1] == '433':
irc_sock.send('NICK {}\r\n'.format(irc_nick).encode())

elif response[1] == '001':
time.sleep(5)
# join the channel
irc_sock.send('JOIN #{}\r\n'.format(channel).encode())
# send messages
for msg in messages:
print('PRIVMSG #{} :{}'.format(channel, msg))
irc_sock.send('PRIVMSG #{} :{}\r\n'.format(channel, msg).encode())
time.sleep(5)
# leave the channel
irc_sock.send('PART #{}\r\n'.format(channel).encode())
sys.exit()
except:
e = sys.exc_info()[0]
print(e)
sys.exit()

0 comments on commit 19167ca

Please sign in to comment.