Skip to content

Commit

Permalink
🐛 Raise error when input is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Feb 11, 2024
1 parent 996a902 commit 8412943
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions mdformat_ruff/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ def format_python(unformatted: str, _info_str: str) -> str:
:type _info_str: str
:rtype: str
"""
ps = subprocess.run(
[find_ruff_bin(), "format", "-"],
input=unformatted.encode(),
capture_output=True,
)
if ps.returncode == 0:
return ps.stdout.decode()
return unformatted
return subprocess.check_output(
[find_ruff_bin(), "format", "-"], input=unformatted.encode()
).decode()

0 comments on commit 8412943

Please sign in to comment.