proc: Don't hardcode clr_eol

Also check if that is actually defined, not the cur_term proxy.

In #5371, we figured out that there are terminfo entries without this
capability, so this would do a NULL-dereference.
This commit is contained in:
Fabian Homborg 2018-11-28 13:02:49 +01:00
parent a730f9fc90
commit 047fcb3224

View file

@ -564,11 +564,7 @@ static void format_job_info(const job_t *j, job_status_t status) {
fwprintf(stdout, L"\r");
fwprintf(stdout, _(msg), j->job_id, truncate_command(j->command()).c_str());
fflush(stdout);
if (cur_term) {
tputs(clr_eol, 1, &writeb);
} else {
fwprintf(stdout, L"\x1B[K");
}
if (clr_eol) tputs(clr_eol, 1, &writeb);
fwprintf(stdout, L"\n");
}
@ -673,11 +669,7 @@ static int process_clean_after_marking(bool allow_interactive) {
signal_get_desc(WTERMSIG(p->status)));
}
if (cur_term != NULL) {
tputs(clr_eol, 1, &writeb);
} else {
fwprintf(stdout, L"\x1B[K"); // no term set up - do clr_eol manually
}
if (clr_eol) tputs(clr_eol, 1, &writeb);
fwprintf(stdout, L"\n");
}
found = 1;