mirror of
https://github.com/systemd/systemd.git
synced 2024-10-27 10:25:37 +03:00
systemctl: make sure "reboot", "suspend" and friends are always asynchronous
Currently, "systemctl reboot" behaves differently in setups with and without logind. If logind is used (which is probably the more common case) the operation is asynchronous, and otherwise synchronous (though subject to --no-block in this case). Let's clean this up, and always expose the same behaviour, regardless if logind is used or not: let's always make it asynchronous. It might make sense to add a "--block" mode in a future PR that makes these operations synchronous, but this requires non-trivial work in logind, and is outside of the scope of this change. See: #6479
This commit is contained in:
parent
36b69c3131
commit
130246d2e8
@ -3585,8 +3585,16 @@ static int start_special(int argc, char *argv[], void *userdata) {
|
||||
/* requested operation is not supported or already in progress */
|
||||
return r;
|
||||
|
||||
/* On all other errors, try low-level operation */
|
||||
}
|
||||
/* On all other errors, try low-level operation. In order to minimize the difference between
|
||||
* operation with and without logind, we explicitly enable non-blocking mode for this, as
|
||||
* logind's shutdown operations are always non-blocking. */
|
||||
|
||||
arg_no_block = true;
|
||||
|
||||
} else if (IN_SET(a, ACTION_EXIT, ACTION_KEXEC))
|
||||
/* Since exit/kexec are so close in behaviour to power-off/reboot, let's also make them
|
||||
* asynchronous, in order to not confuse the user needlessly with unexpected behaviour. */
|
||||
arg_no_block = true;
|
||||
|
||||
r = start_unit(argc, argv, userdata);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user