import os
import sys
import time
from shutil import copyfile

from multiprocessing import Process, Event

import client
import server
import update

if not os.path.isfile("settings.py"):
    copyfile("settings.py.example", "settings.py")
from settings import HONEYPORT, HIVEPORT
from arguments import parse


def main():
    update_event = Event()
    if args.client is not None:
        client_proc = create_process("client", client.main, args, update_event)
        client_proc.start()
    if args.server is not None:
        server_proc = create_process("server", server.main, args, update_event)
        server_proc.start()
    if args.updater:
        trigger_proc = create_process("trigger", update.trigger, update_event)
        trigger_proc.start()
        trigger_proc.join()
    while True:
        try:
            time.sleep(5)
        except KeyboardInterrupt:
            if 'client_proc' in locals():
                if client_proc.is_alive():
                    client_proc.terminate()
            if 'server_proc' in locals():
                if server_proc.is_alive():
                    server_proc.terminate()
            if 'trigger_proc' in locals():
                if trigger_proc.is_alive():
                    trigger_proc.terminate()
            break
    else:
        if args.updater:
            update.pull("origin", "master")
            sys.stdout.flush()
            os.execl(sys.executable, sys.executable, *sys.argv)


def create_process(name, function,  *arguments):
    return Process(
        args=arguments,
        name=name,
        target=function,
        )

if __name__ == '__main__':
    # Parse arguments
    args = parse()
    if args.c:
        args.client = HONEYPORT
    if args.s:
        args.server = HIVEPORT
    try:
        main()
    except KeyboardInterrupt:
        sys.exit()

@@ -399,304 +399,488 @@
 c = 
-create_process(%22client%22, client.main, args, update_event)%0A        client_proc.start()%0A    if args.server is not None:%0A        server_proc = create_process(%22server%22, server.main, args, update_event)%0A        server_proc.start()%0A    if args.updater:%0A        trigger_proc = create_process(%22trigger%22, 
+Process(%0A            args=(args, update_event,),%0A            name=%22client%22,%0A            target=client.main,%0A        )%0A        client_proc.start()%0A    if args.server is not None:%0A        server_proc = Process(%0A            args=(args, update_event,),%0A            name=%22server%22,%0A            target=server.main,%0A        )%0A        server_proc.start()%0A    if args.updater:%0A        trigger_proc = Process(%0A            args=(update_event,),%0A            name=%22trigger%22,%0A            target=
 upda
@@ -890,29 +890,25 @@
 trigger,
- update_event
+%0A        
 )%0A      
@@ -1634,157 +1634,8 @@
 v)%0A%0A
-%0Adef create_process(name, function,  *arguments):%0A    return Process(%0A        args=arguments,%0A        name=name,%0A        target=function,%0A        )%0A%0A
 if _

Remove redundant function