Skip to content

Commit a4937af

Browse files
committed
restore code_utils
1 parent e81e30b commit a4937af

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

codeflash/code_utils/code_utils.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
import re
66
import shutil
77
import site
8+
import sys
89
from contextlib import contextmanager
910
from functools import lru_cache
1011
from pathlib import Path
1112
from tempfile import TemporaryDirectory
1213

1314
import tomlkit
1415

15-
from codeflash.cli_cmds.console import logger
16+
from codeflash.cli_cmds.console import logger, paneled_text
1617
from codeflash.code_utils.config_parser import find_pyproject_toml
1718

1819
ImportErrorPattern = re.compile(r"ModuleNotFoundError.*$", re.MULTILINE)
@@ -215,5 +216,11 @@ def restore_conftest(path_to_content_map: dict[Path, str]) -> None:
215216
path.write_text(file_content, encoding="utf8")
216217

217218

219+
def exit_with_message(message: str, *, error_on_exit: bool = False) -> None:
220+
paneled_text(message, panel_args={"style": "red"})
221+
222+
sys.exit(1 if error_on_exit else 0)
223+
224+
218225
async def dummy_async_function() -> None:
219226
"""Provide a dummy async function for testing purposes."""

0 commit comments

Comments
 (0)