Describe the bug
Using latest version 21.6b0 piping an empty file into black as below causes "string index out of range". This is a regression from 21.5b2.
NOTE: referencing an empty file works as expected this is only when piping into - as example below.
i.e. this works:
touch __init__.py
python -m black __init__.py
All done! ✨ 🍰 ✨
1 file left unchanged.
To Reproduce
touch __init__.py
cat __init__.py | python -m black -
error: cannot format -: string index out of range
Oh no! 💥 💔 💥
1 file failed to reformat.
Expected behavior
Using stdin with empty file works as previous version without error.
Environment (please complete the following information):
- Version:
- OS and Python version:
Does this bug also happen on main?
Yes
Additional context
A bit of a tails case but we're using this approach within a CI script.
Describe the bug
Using latest version 21.6b0 piping an empty file into black as below causes "string index out of range". This is a regression from 21.5b2.
NOTE: referencing an empty file works as expected this is only when piping into - as example below.
i.e. this works:
To Reproduce
Expected behavior
Using stdin with empty file works as previous version without error.
Environment (please complete the following information):
Does this bug also happen on main?
Yes
Additional context
A bit of a tails case but we're using this approach within a CI script.