def stop_executable(name, process_name, cmd=False): """Stop an executable :param name: common name for the program :param process_name: name of the process :param cmd: boolean indicating if it is a cmd window (e.g. Python) """ try: logger.info('Stopping %s...', name) if not cmd: handler = StartStop() handler.exeName = process_name else: handler = CMDStartStop() handler.windowName = process_name result = handler.stopProcess() logger.info('Status: %s', status(result)) except: logger.exception('An exception was generated while stopping %s!', name)