diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-01-04 01:04:20 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-01-04 01:04:20 +0100 |
commit | ec14911e0d6b9473f4f1d6b43d7fcd67c48c2ffc (patch) | |
tree | b7469b9c7e9f04b5498a34bf14da31bc493b139e /src/systemctl.c | |
parent | 1888c9074ab1cb82c1719090561a31d7902df286 (diff) |
systemctl: spawn pager only for commands that generates long output
Diffstat (limited to 'src/systemctl.c')
-rw-r--r-- | src/systemctl.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/systemctl.c b/src/systemctl.c index 59ea7490e7..0908b6ae02 100644 --- a/src/systemctl.c +++ b/src/systemctl.c @@ -113,6 +113,7 @@ static bool private_bus = false; static pid_t pager_pid = 0; static int daemon_reload(DBusConnection *bus, char **args, unsigned n); +static void pager_open(void); static bool on_tty(void) { static int t = -1; @@ -421,6 +422,8 @@ static int list_units(DBusConnection *bus, char **args, unsigned n) { assert(bus); + pager_open(); + if (!(m = dbus_message_new_method_call( "org.freedesktop.systemd1", "/org/freedesktop/systemd1", @@ -767,6 +770,8 @@ static int list_jobs(DBusConnection *bus, char **args, unsigned n) { assert(bus); + pager_open(); + if (!(m = dbus_message_new_method_call( "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"); + if (show_properties) + pager_open(); + if (show_properties && n <= 1) { /* If not argument is specified inspect the manager * itself */ @@ -2860,6 +2868,8 @@ static int dump(DBusConnection *bus, char **args, unsigned n) { dbus_error_init(&error); + pager_open(); + if (!(m = dbus_message_new_method_call( "org.freedesktop.systemd1", "/org/freedesktop/systemd1", @@ -3222,6 +3232,8 @@ static int show_enviroment(DBusConnection *bus, char **args, unsigned n) { dbus_error_init(&error); + pager_open(); + if (!(m = dbus_message_new_method_call( "org.freedesktop.systemd1", "/org/freedesktop/systemd1", @@ -5370,8 +5382,6 @@ int main(int argc, char*argv[]) { goto finish; } - pager_open(); - /* /sbin/runlevel doesn't need to communicate via D-Bus, so * let's shortcut this */ if (arg_action == ACTION_RUNLEVEL) { |