ITADN

Extra newline in output to stdout

#729Openswt30 创建于 2025-11-07
S
swt30commented
**Describe the bug** sqlfmt adds an extra line when formatting SQL from stdin. **To Reproduce** Compare the output of the following: ```sh echo "select 1 from newline;" | sqlfmt - > stdin.sql ``` ```sh echo "select 1 from newline;" > file.sql && sqlfmt file.sql ``` **Expected behavior** sqlfmt should not insert an extra newline in the first case. **Actual behavior** ``` ───────┬──────────────────────────────── │ File: stdin.sql ───────┼──────────────────────────────── 1 │ select 1 2 │ from newline 3 │ ; 4 │ ───────┴──────────────────────────────── ``` ``` ───────┬──────────────────────────────── │ File: file.sql ───────┼──────────────────────────────── 1 │ select 1 2 │ from newline 3 │ ; ───────┴──────────────────────────────── ``` **Additional context** What is the output of `sqlfmt --version`? ``` sqlfmt, version 0.28.2 ``` What is the output of `pip list` (or `pipx list` if you installed using pipx)? ``` Package Version ------------- ------- click 8.1.8 jinja2 3.1.6 markupsafe 3.0.3 platformdirs 4.5.0 shandy-sqlfmt 0.28.2 tqdm 4.67.1 ```
1 条评论