Skip to content

Commit fbdec79

Browse files
wlhlmkeszybz
authored andcommitted
machine: Disable more output when quiet flag is set (systemd#4196)
1 parent 86c2fc2 commit fbdec79

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/machine/machinectl.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,10 +1326,12 @@ static int process_forward(sd_event *event, PTYForward **forward, int master, PT
13261326

13271327
assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGWINCH, SIGTERM, SIGINT, -1) >= 0);
13281328

1329-
if (streq(name, ".host"))
1330-
log_info("Connected to the local host. Press ^] three times within 1s to exit session.");
1331-
else
1332-
log_info("Connected to machine %s. Press ^] three times within 1s to exit session.", name);
1329+
if (!arg_quiet) {
1330+
if (streq(name, ".host"))
1331+
log_info("Connected to the local host. Press ^] three times within 1s to exit session.");
1332+
else
1333+
log_info("Connected to machine %s. Press ^] three times within 1s to exit session.", name);
1334+
}
13331335

13341336
sd_event_add_signal(event, NULL, SIGINT, NULL, NULL);
13351337
sd_event_add_signal(event, NULL, SIGTERM, NULL, NULL);
@@ -1353,12 +1355,14 @@ static int process_forward(sd_event *event, PTYForward **forward, int master, PT
13531355
if (last_char != '\n')
13541356
fputc('\n', stdout);
13551357

1356-
if (machine_died)
1357-
log_info("Machine %s terminated.", name);
1358-
else if (streq(name, ".host"))
1359-
log_info("Connection to the local host terminated.");
1360-
else
1361-
log_info("Connection to machine %s terminated.", name);
1358+
if (!arg_quiet) {
1359+
if (machine_died)
1360+
log_info("Machine %s terminated.", name);
1361+
else if (streq(name, ".host"))
1362+
log_info("Connection to the local host terminated.");
1363+
else
1364+
log_info("Connection to machine %s terminated.", name);
1365+
}
13621366

13631367
sd_event_get_exit_code(event, &ret);
13641368
return ret;

0 commit comments

Comments
 (0)