def __show_console_on_exit(status): end_time = time.time() output = "\n" + TimeDisplay.get_timestamp(end_time) if not status: output += " process terminated successfully" else: output += " process exited with status " + str(status) output += ", elapsed time: " + TimeDisplay.get_elapsed( self.__start_time, end_time) + "\n" if self.__console: self.__console.write_with_links(output)
def terminate(self): """ Called by the user to force the process to end and resolve the associated promises. Interrupt the attached process. """ # get end timestamp end_time = time.time() # Interrupt the process, if any if not self.finished: self.__process.interrupt() if self.__console: self.__console.write_with_links( "\n<^C> process interrupted (elapsed time: %s)\n" % TimeDisplay.get_elapsed(self.__start_time, end_time))