Fix #318: only show "[ OK ] Calling foo" progress for runparts ...

For all other run_parts() use-cases we just give the script control over
stdout/stderr to prevent clobbering ANSI color escape codes.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2022-11-23 21:49:30 +01:00
1 parent c84ababbd4
commit 0498326962
5 files changed
+9 -7

No files matched your search

+5 -3
View File
@@ -441,7 +441,7 @@ pid_t run_sh(char *tty, int noclear, int nowait, struct rlimit rlimit[])
return rc;
}
int run_parts(char *dir, char *cmd)
int run_parts(char *dir, char *cmd, int progress)
{
struct dirent **e;
int i, num;
@@ -490,7 +490,8 @@ int run_parts(char *dir, char *cmd)
strlcat(path, cmd, sizeof(path));
}
print_desc("Calling ", path);
if (progress)
print_desc("Calling ", path);
pid = fork();
if (!pid) {
sig_unblock();
@@ -503,7 +504,8 @@ int run_parts(char *dir, char *cmd)
warnx("%s exited with status %d", path, exit_status);
else if (WIFSIGNALED(status))
warnx("%s terminated by signad %d", path, WTERMSIG(status));
print_result(status);
if (progress)
print_result(status);
}
while (num--)