def close(logger, testLauncher, coverage):
    """ SIGINT Handler which clean up processes  """

    # Check if some scripts are running, if this is the case
    # we warn the user.
    if ScriptLoggerThread.getRunningInstances():
        try:
            logger.info("{} \n {}".format(
                "Some subprocesses are still running. The program will wait them before exiting.",
                "If you really want to exit, please confirm by typing Ctrl+C again"))

            # Wait for thread to terminate
            while ScriptLoggerThread.getRunningInstances():
                time.sleep(1)
        except KeyboardInterrupt as e:
            pass

    # Kill subprocess (at least test-platform one)
    SubprocessLoggerThread.closeAll()

    if coverage:
        testLauncher.generateCoverage()

    logger.info("Closing")

    exit(0)
    def __call_process(self, cmd, isAsynchronous=False, isScriptThread=False):
        """ Private function which call a shell command """

        if isScriptThread:
            self.__logger.info("Launching script : {}".format(" ".join(cmd)))
            launcher = ScriptLoggerThread(cmd, self.__consoleLogger)
        else:
            self.__logger.debug("Launching command : {}".format(" ".join(cmd)))
            launcher = SubprocessLoggerThread(cmd, self.__consoleLogger)

        launcher.start()

        if not isAsynchronous:
            # if the process is synchronous, we wait him before continuing
            launcher.join()