summaryrefslogtreecommitdiff
path: root/src/machine
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-22 20:33:45 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-23 03:26:24 +0100
commitc7b7d4493aa03e9ef5fb1e670b8969a48aa494dd (patch)
tree4346b1fd2410b60fac0e7a0dab6e027f7fb8bdb0 /src/machine
parent9b15b7846d4de01bb5d9700a24077787e984e8ab (diff)
machinectl,nspawn: don't print extra final newline if pty terminal output was newline-terinated anyway
Diffstat (limited to 'src/machine')
-rw-r--r--src/machine/machinectl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 4eebcb7716..f5b87a23d2 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -1110,6 +1110,7 @@ static int login_machine(int argc, char *argv[], void *userdata) {
pid_t leader;
sigset_t mask;
int r, ret = 0;
+ char last_char = 0;
assert(bus);
@@ -1186,9 +1187,12 @@ static int login_machine(int argc, char *argv[], void *userdata) {
if (r < 0)
return log_error_errno(r, "Failed to run event loop: %m");
+ pty_forward_last_char(forward, &last_char);
+
forward = pty_forward_free(forward);
- fputc('\n', stdout);
+ if (last_char != '\n')
+ fputc('\n', stdout);
log_info("Connection to container %s terminated.", argv[1]);