Run a debug command.
171020
def debug(self, debug_commands):
    """"""
    if isinstance(debug_commands, sc_debug.DebugCommand):
      debug_commands = [debug_commands]
    return self._client.send(debug=sc_pb.RequestDebug(debug=debug_commands))
1172254
def run (self):
        """"""
        try:
            self.run_checked()
        except KeyboardInterrupt:
            thread.interrupt_main()
        except Exception:
            self.internal_error()
47459
def run(self, argv):
        """"""
        try:
            self.options, remainder = self.parser.parse_known_args(argv)
            self._configure_logging()

            if self.options.relative_plugins:
                curdir = os.getcwd()
                sys.path.insert(0, curdir)
                pkg_resources.working_set.add_entry(curdir)


            try:
                self._load_commands_for_current_dir()
            except pkg_resources.DistributionNotFound as e:
                try:
                    error_msg = repr(e)
                except:
                    error_msg = 'Unknown Error'

                log.error('Failed to load project commands with error '
                          '``%s``, have you installed your project?' % error_msg)

        except Exception as err:
            if hasattr(self, 'options'):
                debug = self.options.debug
            else:
                debug = True

            if debug:
                log.exception(err)
            else:
                log.error(err)

            return 1

        return self._run_subcommand(remainder)
1042949
def debug_transform(ctx, transform, params, value, fields):
    """"""
    from canari.commands.debug_transform import debug_transform
    debug_transform(transform, value, fields, params, ctx.project, ctx.config)
1193043
def run(cmd, data=None, checks=None, region=None, log_error=True,
        log_stdout=False):
    
    try:
        logger.debug(" ".join(str(x) for x in cmd) if not isinstance(cmd, basestring) else cmd)
        _do_run(cmd, checks, log_stdout)
    except:
        if log_error:
            logger.info("error at command")
        raise
770016
def run(self):
        """"""
        self.logger.debug(f'Running command: {self.cmd}')

        def execute(cmd):
            output = ""
            popen = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
                                     universal_newlines=True, shell=True)
            for stdout_line in iter(popen.stdout.readline, ""):
                stdout_line = stdout_line.strip('\n')
                output += stdout_line
                yield stdout_line
            popen.stdout.close()
            return_code = popen.wait()
            if return_code:
                raise subprocess.CalledProcessError(return_code, cmd, output)

        try:
            for out in execute(self.cmd):
                self.logger.info(out)
            return "", 0
        except subprocess.CalledProcessError as e:
            return e.output, e.returncode
351448
def debug(self, key):
        """"""
        return (not self.quiet and not self.debug_none and
                (self.debug_all or getattr(self, "debug_%s" % key)))
92914
def enable_debug(self):
        """"""

        if not self.connected:
            raise HardwareError("Cannot enable debug if we are not in a connected state")

        self._loop.run_coroutine(self.adapter.open_interface(0, 'debug'))
717842
def debug(*args, **attrs):
    """"""
    attrs.setdefault("is_flag", True)
    attrs.setdefault("default", None)
    return option(debug, *args, **attrs)
311826
def run_cmd(command, verbose=True, shell='/bin/bash'):
    """"""
    process = Popen(command, shell=True, stdout=PIPE, stderr=STDOUT, executable=shell)
    output = process.stdout.read().decode().strip().split('\n')
    if verbose:
        # return full output including empty lines
        return output
    return [line for line in output if line.strip()]
339791
def Run(self, unused_args):
    """"""
    if flags.FLAGS.pdb_post_mortem:
      logging.warning("Segfault action requested :(")
      print(ctypes.cast(1, ctypes.POINTER(ctypes.c_void_p)).contents)
    else:
      logging.warning("Segfault requested but not running in debug mode.")
445509
def debug_sql(sql: str, *args: Any) -> None:
    """"""
    log.debug("SQL: %s" % sql)
    if args:
        log.debug("Args: %r" % args)
1178336
def run(debug=False):
    """"""
    FLAGS(sys.argv)
    config = gameConfig.Config(
        version=None, # vers is None... unless a specific game version is desired
        themap=selectMap(ladder=True), # pick a random ladder map
        players=["defaulthuman", "blizzbot2_easy"],
    )
    createReq = sc_pb.RequestCreateGame( # used to advance to "Init Game" state, when hosting
        realtime    = config.realtime,
        disable_fog = config.fogDisabled,
        random_seed = int(now()), # a game is created using the current second timestamp as the seed
        local_map   = sc_pb.LocalMap(map_path=config.mapLocalPath,
                                     map_data=config.mapData) )
    joinRace = None
    for player in config.players:
        reqPlayer = createReq.player_setup.add() # add new player; get link to settings
        playerObj = PlayerPreGame(player)
        if playerObj.isComputer:
              reqPlayer.difficulty  = playerObj.difficulty.gameValue()
              pType                 = playerObj.type.type
        else: pType                 = c.PARTICIPANT
        reqPlayer.type              = t.PlayerControls(pType).gameValue()
        reqPlayer.race              = playerObj.selectedRace.gameValue()
        if not playerObj.isComputer:
            joinRace                = reqPlayer.race
    interface = sc_pb.InterfaceOptions()
    raw,score,feature,rendered = config.interfaces
    interface.raw   = raw   # whether raw data is reported in observations
    interface.score = score # whether score data is reported in observations
    interface.feature_layer.width = 24
    joinReq = sc_pb.RequestJoinGame(options=interface) # SC2APIProtocol.RequestJoinGame
    joinReq.race = joinRace # update joinGame request as necessary
    if debug: print("Starcraft2 game process is launching.")
    controller = None
    with config.launchApp() as controller:
      try:
        if debug: print("Starcraft2 application is live. (%s)"%(controller.status)) # status: launched
        controller.create_game(createReq)
        if debug: print("Starcraft2 is waiting for %d player(s) to join. (%s)"%(config.numAgents, controller.status)) # status: init_game
        playerID = controller.join_game(joinReq).player_id # SC2APIProtocol.RequestJoinGame
        print("[GET IN-GAME DATA] player#%d %s"%(playerID, config))
        return (controller.ping(), controller.data())
      except (protocol.ConnectionError, protocol.ProtocolError, remote_controller.RequestError) as e:
        if debug:   print("%s Connection to game closed (NOT a bug)%s%s"%(type(e), os.linesep, e))
        else:       print(   "Connection to game closed.")
      except KeyboardInterrupt:
        print("caught command to forcibly shutdown Starcraft2 host server.")
      finally:
        config.disable() # if the saved cfg file still exists, always remove it
        controller.quit()
1211553
def run(url, cmd, log_path, log_level, log_session, force_discovery, print_info):
    """"""
    log_level = log_levels[log_level]
    conn = condoor.Connection("host", list(url), log_session=log_session, log_level=log_level, log_dir=log_path)
    try:
        conn.connect(force_discovery=force_discovery)
        if print_info:
            echo_info(conn)

        for command in cmd:
            result = conn.send(command)
            print("\nCommand: {}".format(command))
            print("Result: \n{}".format(result))
    except (condoor.ConnectionError, condoor.ConnectionAuthenticationError, condoor.ConnectionTimeoutError,
            condoor.InvalidHopInfoError, condoor.CommandSyntaxError, condoor.CommandTimeoutError,
            condoor.CommandError, condoor.ConnectionError) as excpt:
        click.echo(excpt)
    finally:
        conn.disconnect()
    return
1201717
def run_command(self, codeobj):
        """"""
        try:
            value, stdout = yield from self.attempt_exec(codeobj, self.namespace)
        except Exception:
            yield from self.send_exception()
            return
        else:
            yield from self.send_output(value, stdout)
796009
def run_program(program, *args):
    """"""
    real_args = [program]
    real_args.extend(args)
    logging.debug(_('check_output arguments: %s'), real_args)
    check_output(real_args, universal_newlines=True)
1155226
def runcmd(command, command_input=None, cwd=None):
    """"""
    proc = subprocess.Popen(command, stdin=subprocess.PIPE,
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE,
                            cwd=cwd)
    (stdout, stderr) = proc.communicate(command_input)
    if proc.returncode != 0:
        sys.stderr.write('ABORTING: command "%s" failed w/ code %s:\n'
                         '%s\n%s' % (command, proc.returncode,
                                     stdout, stderr))
        sys.exit(proc.returncode)
    return proc.returncode, stdout, stderr