def METHOD_NAME(command: str | None, cwd: Path) -> None:
    if command:
        log.info(f"Running {command} in {cwd}")
    else:
        log.info(f"Opening terminal in {cwd}")
    env = common.prepare_env()
    widget = get_main_window()  # any tkinter widget works
    windowingsystem = widget.tk.call("tk", "windowingsystem")
    if windowingsystem == "win32":
        _run_in_windows_cmd(command, cwd, env)
    elif windowingsystem == "aqua" and not os.environ.get("TERMINAL", ""):
        _run_in_macos_terminal_app(command, cwd, env)
    else:
        _run_in_x11_like_terminal(command, cwd, env)