Skip to content

Commit f9c2926

Browse files
committed
quick fix
1 parent 246801d commit f9c2926

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

codeflash/code_utils/env_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def check_formatter_installed(formatter_cmds: list[str], exit_on_failure: bool =
2222
f.flush()
2323
tmp_file = Path(f.name)
2424
try:
25-
format_code(formatter_cmds, tmp_file)
25+
format_code(formatter_cmds, tmp_file, capture_output=False)
2626
except Exception:
2727
print(
2828
"⚠️ Codeflash requires a code formatter to be installed in your environment, but none was found. Please install a supported formatter, verify the formatter-cmds in your codeflash pyproject.toml config and try again."

codeflash/code_utils/formatter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from pathlib import Path
1414

1515

16-
def format_code(formatter_cmds: list[str], path: Path) -> str:
16+
def format_code(formatter_cmds: list[str], path: Path, capture_output: bool = True) -> str: # noqa
1717
# TODO: Only allow a particular whitelist of formatters here to prevent arbitrary code execution
1818
formatter_name = formatter_cmds[0].lower()
1919
if not path.exists():
@@ -26,7 +26,7 @@ def format_code(formatter_cmds: list[str], path: Path) -> str:
2626
formatter_cmd_list = shlex.split(command, posix=os.name != "nt")
2727
formatter_cmd_list = [path.as_posix() if chunk == file_token else chunk for chunk in formatter_cmd_list]
2828
try:
29-
result = subprocess.run(formatter_cmd_list, capture_output=True, check=False)
29+
result = subprocess.run(formatter_cmd_list, capture_output=capture_output, check=False)
3030
if result.returncode == 0:
3131
console.rule(f"Formatted Successfully with: {formatter_name.replace('$file', path.name)}")
3232
else:

0 commit comments

Comments
 (0)