Start the executable.

        Args:
            use_atexit (bool): If True, the process will automatically be
                terminated at exit.
960110
def start(self, use_atexit=True):
        '''
        '''
        assert not self._process

        _logger.debug('Starting process %s', self._proc_args)

        process_future = asyncio.create_subprocess_exec(
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            *self._proc_args
        )
        self._process = yield from process_future

        self._stderr_reader = asyncio.async(self._read_stderr())
        self._stdout_reader = asyncio.async(self._read_stdout())

        if use_atexit:
            atexit.register(self.close)
407752
def restart():
    
    python = sys.executable
    os.execl(python, python, * sys.argv)
564937
def restart(self):
        
        if self.verbose:
            print("Restarting {} {} ...".format(sys.executable, sys.argv))
        os.execl(sys.executable, *([sys.executable] + sys.argv))
1002717
def shutdown(self):
        

        if not self._exited:
            self._exited = True
            _shutdown_pipe(self._pipe)
            self._task.stop()
            raise SystemExit
421175
def main():
    
    try:
        args = parse_daemon_args()
        daemon = Alignak(**args.__dict__)
        daemon.main()
    except Exception as exp:  # pylint: disable=broad-except
        sys.stderr.write("*** Daemon exited because: %s" % str(exp))
        traceback.print_exc()
        exit(1)
1261025
def start_prompt(self):
        """"""
        logger.show("Coconut Interpreter:")
        logger.show("(type 'exit()' or press Ctrl-D to end)")
        self.start_running()
        while self.running:
            try:
                code = self.get_input()
                if code:
                    compiled = self.handle_input(code)
                    if compiled:
                        self.execute(compiled, use_eval=None)
            except KeyboardInterrupt:
                printerr("\nKeyboardInterrupt")
374055
def run():
	
	parser = argparse.ArgumentParser()
	parser.add_argument(
		'--deps-def',
		default=data_lines_from_file("system deps.txt")
		+ data_lines_from_file("build deps.txt"),
		help="A file specifying the dependencies (one per line)",
		type=data_lines_from_file, dest="spec_deps")
	parser.add_argument(
		'--dep', action="append", default=[],
		help="A specific dependency (multiple allowed)", dest="deps")
	parser.add_argument(
		'command', type=shlex.split,
		default=shlex.split("python2.7 setup.py test"),
		help="Command to invoke in the context of the dependencies")
	parser.add_argument(
		'--do-not-remove', default=False, action="store_true",
		help="Keep any installed packages")
	parser.add_argument(
		'--aggressively-remove', default=False,
		action="store_true",
		help="When removing packages, also remove those automatically installed"
		" as dependencies")
	parser.add_argument(
		'-l', '--log-level', default=logging.INFO,
		type=log_level, help="Set log level (DEBUG, INFO, WARNING, ERROR)")
	args = parser.parse_args()
	logging.basicConfig(level=args.log_level)
	context = dependency_context(
		args.spec_deps + args.deps,
		aggressively_remove=args.aggressively_remove)
	with context as to_remove:
		if args.do_not_remove:
			del to_remove[:]
		raise SystemExit(subprocess.Popen(args.command).wait())
433482
async def _start(self):
        
        self.agent._alive.wait()
        try:
            await self.on_start()
        except Exception as e:
            logger.error("Exception running on_start in behaviour {}: {}".format(self, e))
            self.kill(exit_code=e)
        await self._step()
        self._is_done.clear()
365210
def run(self):
        ''''''
        with spawn_output_reader() as (stdout_capture, stdout_thread):
            with spawn_output_reader() as (stderr_capture, stderr_thread):
                context = starter_iocontext(stdout_capture, stderr_capture)
                status = self._exec(context)
        stdout_bytes = stdout_thread.join()
        stderr_bytes = stderr_thread.join()
        result = Result(status.code, stdout_bytes, stderr_bytes)
        if is_checked_error(status):
            raise StatusError(result, self)
        return result
1312411
def main(args, stop=False):
    
    daemon = AMQPDaemon(
        con_param=getConParams(
            settings.RABBITMQ_ANTIVIRUS_VIRTUALHOST
        ),
        queue=settings.RABBITMQ_ANTIVIRUS_INPUT_QUEUE,
        out_exch=settings.RABBITMQ_ANTIVIRUS_EXCHANGE,
        out_key=settings.RABBITMQ_ANTIVIRUS_OUTPUT_KEY,
        react_fn=reactToAMQPMessage,
        glob=globals()                # used in deserializer
    )

    if not stop and args.foreground:  # run at foreground
        daemon.run()
    else:
        daemon.run_daemon()
849235
def start(self):
        '''
        
        '''
        # invoke the appropriate sub-command as requested from command-line
        try:
            self.args.func()
        except SystemExit as e:
            if e.code != 0:
                raise
        except KeyboardInterrupt:
            self.log.warning("exited via keyboard interrupt")
        except:
            self.log.exception("exited start function")
            # set exit code so we know it did not end successfully
            # TODO different exit codes based on signals ?
        finally:
            self._flush_metrics_q.put(None, block=True)
            self._flush_metrics_q.put(None, block=True, timeout=1)

        self.log.debug("exited_successfully")
193906
def start(self, *args, **kwargs):
        
        warnings.warn(
            "The 'start()' method is deprecated, please use 'add()' instead", DeprecationWarning
        )
        return self.add(*args, **kwargs)
267010
def run(entry_point, drivers, loop = None):
    ''' 
    '''
    program = setup(entry_point, drivers)
    dispose = program.run()
    if loop == None:
        loop = asyncio.get_event_loop()

    loop.run_forever()
    dispose()
485128
def kill_mprocess(process):
    
    if process and proc_alive(process):
        process.terminate()
        process.communicate()
    return not proc_alive(process)
1249723
def _execute(self, app_, file_):
        
        app_name = os.path.basename(app_)
        args = [app_]
        args.extend(self.args[app_])
        args.append(file_)
        process = subprocess.Popen(args)

        time.sleep(1)
        status = {True: Status.SUCCESS, False: Status.FAILED}
        crashed = process.poll()
        result = status[crashed is None]
        self.stats_.add(app_name, result)
        if result is Status.SUCCESS:
            # process did not crash, so just terminate it
            process.terminate()
969630
def finalize(self, shutit):
		
		# Finish with the target
		target_child_pexpect_session = shutit.get_shutit_pexpect_session_from_id('target_child')
		assert not target_child_pexpect_session.sendline(ShutItSendSpec(target_child_pexpect_session,'exit',ignore_background=True)), shutit_util.print_debug()
		return True
792162
def cleanup():
    
    _log.debug("P4P atexit begins")
    # clean provider registry
    from .server import clearProviders, _cleanup_servers
    clearProviders()

    # close client contexts
    from .client.raw import _cleanup_contexts
    _cleanup_contexts()

    # stop servers
    _cleanup_servers()

    # shutdown default work queue
    from .util import _defaultWorkQueue
    _defaultWorkQueue.stop()
    _log.debug("P4P atexit completes")