mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-26 13:45:14 +07:00
systemctl: spawn pager only for commands that generates long output
This commit is contained in:
parent
1888c9074a
commit
ec14911e0d
@ -113,6 +113,7 @@ static bool private_bus = false;
|
|||||||
static pid_t pager_pid = 0;
|
static pid_t pager_pid = 0;
|
||||||
|
|
||||||
static int daemon_reload(DBusConnection *bus, char **args, unsigned n);
|
static int daemon_reload(DBusConnection *bus, char **args, unsigned n);
|
||||||
|
static void pager_open(void);
|
||||||
|
|
||||||
static bool on_tty(void) {
|
static bool on_tty(void) {
|
||||||
static int t = -1;
|
static int t = -1;
|
||||||
@ -421,6 +422,8 @@ static int list_units(DBusConnection *bus, char **args, unsigned n) {
|
|||||||
|
|
||||||
assert(bus);
|
assert(bus);
|
||||||
|
|
||||||
|
pager_open();
|
||||||
|
|
||||||
if (!(m = dbus_message_new_method_call(
|
if (!(m = dbus_message_new_method_call(
|
||||||
"org.freedesktop.systemd1",
|
"org.freedesktop.systemd1",
|
||||||
"/org/freedesktop/systemd1",
|
"/org/freedesktop/systemd1",
|
||||||
@ -767,6 +770,8 @@ static int list_jobs(DBusConnection *bus, char **args, unsigned n) {
|
|||||||
|
|
||||||
assert(bus);
|
assert(bus);
|
||||||
|
|
||||||
|
pager_open();
|
||||||
|
|
||||||
if (!(m = dbus_message_new_method_call(
|
if (!(m = dbus_message_new_method_call(
|
||||||
"org.freedesktop.systemd1",
|
"org.freedesktop.systemd1",
|
||||||
"/org/freedesktop/systemd1",
|
"/org/freedesktop/systemd1",
|
||||||
@ -2477,6 +2482,9 @@ static int show(DBusConnection *bus, char **args, unsigned n) {
|
|||||||
|
|
||||||
show_properties = !streq(args[0], "status");
|
show_properties = !streq(args[0], "status");
|
||||||
|
|
||||||
|
if (show_properties)
|
||||||
|
pager_open();
|
||||||
|
|
||||||
if (show_properties && n <= 1) {
|
if (show_properties && n <= 1) {
|
||||||
/* If not argument is specified inspect the manager
|
/* If not argument is specified inspect the manager
|
||||||
* itself */
|
* itself */
|
||||||
@ -2860,6 +2868,8 @@ static int dump(DBusConnection *bus, char **args, unsigned n) {
|
|||||||
|
|
||||||
dbus_error_init(&error);
|
dbus_error_init(&error);
|
||||||
|
|
||||||
|
pager_open();
|
||||||
|
|
||||||
if (!(m = dbus_message_new_method_call(
|
if (!(m = dbus_message_new_method_call(
|
||||||
"org.freedesktop.systemd1",
|
"org.freedesktop.systemd1",
|
||||||
"/org/freedesktop/systemd1",
|
"/org/freedesktop/systemd1",
|
||||||
@ -3222,6 +3232,8 @@ static int show_enviroment(DBusConnection *bus, char **args, unsigned n) {
|
|||||||
|
|
||||||
dbus_error_init(&error);
|
dbus_error_init(&error);
|
||||||
|
|
||||||
|
pager_open();
|
||||||
|
|
||||||
if (!(m = dbus_message_new_method_call(
|
if (!(m = dbus_message_new_method_call(
|
||||||
"org.freedesktop.systemd1",
|
"org.freedesktop.systemd1",
|
||||||
"/org/freedesktop/systemd1",
|
"/org/freedesktop/systemd1",
|
||||||
@ -5370,8 +5382,6 @@ int main(int argc, char*argv[]) {
|
|||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
pager_open();
|
|
||||||
|
|
||||||
/* /sbin/runlevel doesn't need to communicate via D-Bus, so
|
/* /sbin/runlevel doesn't need to communicate via D-Bus, so
|
||||||
* let's shortcut this */
|
* let's shortcut this */
|
||||||
if (arg_action == ACTION_RUNLEVEL) {
|
if (arg_action == ACTION_RUNLEVEL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user