mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
systemctl: show success messages when showing transaction
Extend `--show-transaction` so it shows a success message when an unit is successfully started.
This commit is contained in:
@@ -279,8 +279,15 @@ static int check_wait_response(BusWaitForJobs *d, WaitJobsFlags flags, const cha
|
||||
return -EOPNOTSUPP;
|
||||
else if (streq(d->result, "once"))
|
||||
return -ESTALE;
|
||||
else if (STR_IN_SET(d->result, "done", "skipped"))
|
||||
else if (streq(d->result, "done")) {
|
||||
if (FLAGS_SET(flags, BUS_WAIT_JOBS_LOG_SUCCESS))
|
||||
log_info("Job for %s finished.", strna(d->name));
|
||||
return 0;
|
||||
} else if (streq(d->result, "skipped")) {
|
||||
if (FLAGS_SET(flags, BUS_WAIT_JOBS_LOG_SUCCESS))
|
||||
log_info("Job for %s was skipped.", strna(d->name));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EIO),
|
||||
"Unexpected job result, assuming server side newer than us: %s", d->result);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
typedef enum WaitJobsFlags {
|
||||
BUS_WAIT_JOBS_LOG_ERROR = 1 << 0,
|
||||
BUS_WAIT_JOBS_LOG_SUCCESS = 1 << 1,
|
||||
} WaitJobsFlags;
|
||||
|
||||
typedef struct BusWaitForJobs BusWaitForJobs;
|
||||
|
||||
@@ -391,6 +391,7 @@ int verb_start(int argc, char *argv[], void *userdata) {
|
||||
WaitJobsFlags flags = 0;
|
||||
|
||||
SET_FLAG(flags, BUS_WAIT_JOBS_LOG_ERROR, !arg_quiet);
|
||||
SET_FLAG(flags, BUS_WAIT_JOBS_LOG_SUCCESS, arg_show_transaction);
|
||||
r = bus_wait_for_jobs(w, flags, make_extra_args(extra_args));
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
Reference in New Issue
Block a user