INNER CODE UNIT · Python

execute_command

gorilla-llm/gorilla-cli · go_cli.py:188

    def execute_command(cmd):
        cmd = format_command(cmd)
        process = subprocess.run(cmd, shell=True, stderr=subprocess.PIPE)

        save = not cmd.startswith(':')
        if save:
            append_string_to_file_if_missing(HISTORY_FILE, cmd)

        error_msg = process.stderr.decode("utf-8", "ignore")
        if error_msg:
            print(f"{error_msg}")
            return error_msg
        return str(process.returncode)

    def get_history_commands(history_file):
        """
        Takes in history file
        Returns None if file doesn't exist or empty

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…