systemctl: shorter list-jobs --before/--after output a bit

(before)$ systemctl list-jobs  --before --after
 JOB UNIT                                          TYPE  STATE
8769 foobar.device                                 start running
        A job waits for this job: 8669 (run-rb6da596d0cfa4e36b7c594cd973e795a.service/start)
8669 run-rb6da596d0cfa4e36b7c594cd973e795a.service start waiting
        This job waits for a job: 8769 (foobar.device/start)

2 jobs listed.

(after)$ systemctl list-jobs  --before --after
 JOB UNIT                                          TYPE  STATE
8769 foobar.device                                 start running
        waiting for job 8669 (run-rb6da596d0cfa4e36b7c594cd973e795a.service/start)
8669 run-rb6da596d0cfa4e36b7c594cd973e795a.service start waiting
        blocking job 8769 (foobar.device/start)

2 jobs listed.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2016-11-16 20:51:47 -05:00
parent 7d992a6ede
commit bc357ce5d7

View File

@ -2227,7 +2227,7 @@ static void output_waiting_jobs(sd_bus *bus, uint32_t id, const char *method, co
}
while ((r = sd_bus_message_read(reply, "(usssoo)", &other_id, &name, &type, &state, &job_path, &unit_path)) > 0)
printf("%s%u (%s/%s)\n", prefix, other_id, name, type);
printf("%s %u (%s/%s)\n", prefix, other_id, name, type);
if (r < 0) {
bus_log_parse_error(r);
return;
@ -2309,9 +2309,9 @@ static void output_jobs_list(sd_bus *bus, const struct job_info* jobs, unsigned
on, state_len, j->state, off);
if (arg_jobs_after)
output_waiting_jobs(bus, j->id, "GetJobAfter", "\tA job waits for this job: ");
output_waiting_jobs(bus, j->id, "GetJobAfter", "\twaiting for job");
if (arg_jobs_before)
output_waiting_jobs(bus, j->id, "GetJobBefore", "\tThis job waits for a job: ");
output_waiting_jobs(bus, j->id, "GetJobBefore", "\tblocking job");
}
if (!arg_no_legend) {