3 # Test hook to launch an irker instance (if it doesn't already exist)
4 # just before shipping the notification. We start it in in another terminal
5 # so you can watch the debug messages. Probably only of interest only to
8 # To use it, set up irkerhook.py to file on each commit.
9 # Then set the filtercmd variable in your repo config as follows:
12 # filtercmd = filter-test.py
14 # This is rather antisocial - imagine thousands of irkerds holding open
15 # connections to IRCDs. It's better to go through an instance running
16 # at your forge or set up for shared use by your intranet administrator.
18 import os, sys, json, subprocess, time
19 metadata = json.loads(sys.argv[1])
21 ps = subprocess.Popen("ps -U %s uh" % os.getenv("LOGNAME"),
23 stdout=subprocess.PIPE)
24 data = ps.stdout.read()
25 irkerd_count = len([x for x in data.split("\n") if x.find("irkerd") != -1])
28 os.system("gnome-terminal --title 'irkerd' -e 'irkerd -d 2' &")
30 time.sleep(0.1) # Avoid a race condition
32 print json.dumps(metadata)