(cmd, working_dir, timelimit)
return out, errors, process.returncode
Run a compilation command in the sandbox.
    :param cmd: The command to run.
    :param working_dir: The directory to run the command in.
    :param timelimit: The number of seconds the command is allowed to run.
    :return: The value of stdout as well as any errors that occurred.
Run a compilation command in the sandbox.
    :param cmd: The command to run.
    :param working_dir: The directory to run the command in.
    :param timelimit: The number of seconds the command is allowed to run.
    :return: The value of stdout as well as any errors that occurred.
Run a compilation command in the sandbox . : param cmd : The command to run . : param working_dir : The directory to run the command in . : param timelimit : The number of seconds the command is allowed to run . : return : The value of stdout as well as any errors that occurred .
def _run_cmd(cmd, working_dir, timelimit):
    """
    Run a compilation command in the sandbox.
    :param cmd: The command to run.
    :param working_dir: The directory to run the command in.
    :param timelimit: The number of seconds the command is allowed to run.
    :return: The value of stdout as well as any errors that occurred.
    """
    absoluteWorkingDir = os.path.abspath(working_dir)
    cmd = "sudo -H -iu bot_compilation bash -c \"cd "+absoluteWorkingDir+"; "+cmd+"\""
    print(cmd)
    process = subprocess.Popen(cmd, cwd=working_dir, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)

    try:
        rawOut, rawErrors = process.communicate(timeout=timelimit)
        outString = rawOut.decode("utf-8").strip()
        out = outString.split("\n") if outString.isspace() == False and outString != "" else None

        errorsString = rawErrors.decode("utf-8").strip()
        errors = errorsString.split("\n") if errorsString.isspace() == False and errorsString != "" else None
    except subprocess.TimeoutExpired:
        out = []
        errors = ["Compilation timed out with command %s" % (cmd,)]

    # Clean up any processes that didn't exit cleanly
    util.kill_processes_as("bot_compilation")

    return out, errors, process.returncode
def _run_cmd ( cmd , working_dir , timelimit ) : absoluteWorkingDir = os . path . abspath ( working_dir ) cmd = "sudo -H -iu bot_compilation bash -c \"cd " + absoluteWorkingDir + "; " + cmd + "\"" print ( cmd ) process = subprocess . Popen ( cmd , cwd = working_dir , shell = True , stdout = subprocess . PIPE , stderr = subprocess . PIPE , stdin = subprocess . PIPE ) try : rawOut , rawErrors = process . communicate ( timeout = timelimit ) outString = rawOut . decode ( "utf-8" ) . strip ( ) out = outString . split ( "\n" ) if outString . isspace ( ) == False and outString != "" else None errorsString = rawErrors . decode ( "utf-8" ) . strip ( ) errors = errorsString . split ( "\n" ) if errorsString . isspace ( ) == False and errorsString != "" else None except subprocess . TimeoutExpired : out = [ ] errors = [ "Compilation timed out with command %s" % ( cmd , ) ] # Clean up any processes that didn't exit cleanly util . kill_processes_as ( "bot_compilation" ) return out , errors , process . returncode