Skip to content

Commit 5db82f1

Browse files
committed
avoid adding newline when previous command comes with one
Signed-off-by: Evangelos Lamprou <vagos@lamprou.xyz>
1 parent 9dffb9b commit 5db82f1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

libbash/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def ast_to_bash(ast: list[Command], write_to: str):
6262
for comm in ast:
6363
command_string = bash.make_command_string(comm._to_ctypes())
6464
bash_str += command_string
65-
bash_str += "\n".encode("utf-8")
65+
bash_str += "\n".encode("utf-8") if not bash_str.endswith(b"\n") else b""
6666

6767
with open(write_to, "wb") as f:
6868
# don't decode the bytes, just write them to the file

0 commit comments

Comments
 (0)