File 2627-shell-Strip-extra-newline-after-expression.patch of Package erlang
From 891ce477904ee45507e80b3dfef30a99d5a67c8a Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Thu, 4 Jan 2024 09:56:54 +0100
Subject: [PATCH 07/11] shell: Strip extra newline after expression
---
lib/kernel/src/group.erl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/kernel/src/group.erl b/lib/kernel/src/group.erl
index 001c6fd7e1..1527fba9e4 100644
--- a/lib/kernel/src/group.erl
+++ b/lib/kernel/src/group.erl
@@ -939,7 +939,7 @@ format_expression(Cont, Drv) ->
try
case FormatingCommand of
default ->
- Buffer;
+ string:trim(Buffer, trailing, "\n");
{M,F} when is_atom(M), is_atom(F) ->
M:F(Buffer);
FormatingCommand1 when is_list(FormatingCommand1) ->
@@ -948,7 +948,7 @@ format_expression(Cont, Drv) ->
catch _:_ ->
send_drv_reqs(Drv, [{put_chars, unicode, io_lib:format("* Bad format function: ~tp~n", [FormatingCommand])}]),
_ = shell:format_shell_func(default),
- Buffer
+ string:trim(Buffer, trailing, "\n")
end.
format_expression1(Buffer, FormatingCommand) ->
%% Write the current expression to a file, format it with a formatting tool
--
2.35.3