]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: disable pager in --dry-run=no mode
authorLennart Poettering <lennart@poettering.net>
Thu, 28 Sep 2023 16:20:41 +0000 (18:20 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 5 Oct 2023 17:03:46 +0000 (19:03 +0200)
When --dry-run=yes is used it makes sense to spawn a pager to look at
the report it provides you with about what it is about to do. Hoewver,
when we are actually doing it, then the output is more in the category
of "logs" than "review material", and logs we generally don't page when
we generate them.

src/partition/repart.c

index 9f9acdff1edafb01e7358965cccc3a562ae47ad8..9b56444404898f57a08cf5bc739ac7ac746d7b58 100644 (file)
@@ -6806,6 +6806,10 @@ static int parse_argv(int argc, char *argv[]) {
         else if (dry_run >= 0)
                 arg_dry_run = dry_run;
 
+        /* Disable pager once we are not just reviewing, but doing things. */
+        if (!arg_dry_run)
+                arg_pager_flags |= PAGER_DISABLE;
+
         if (arg_empty == EMPTY_CREATE && (arg_size == UINT64_MAX && !arg_size_auto))
                 return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
                                        "If --empty=create is specified, --size= must be specified, too.");