execute: also hook up ansi-seq-based terminal size determination with exec_context_determine_size()

And while we are at it, merge exec_context_determine_tty_size() +
exec_context_apply_tty_size().

Let's simplify things, and merge the two funcs, since the latter just
does one more call.

At the same time, let's make sure we actually allow passing separate
input/output fds.
This commit is contained in:
Lennart Poettering
2024-07-19 11:44:04 +02:00
parent 967bcc6e26
commit 3f2e8e951a
3 changed files with 29 additions and 25 deletions
+3 -3
View File
@@ -360,7 +360,7 @@ static int setup_input(
if (context->tty_reset)
(void) terminal_reset_defensive(STDIN_FILENO, /* switch_to_text= */ true);
(void) exec_context_apply_tty_size(context, STDIN_FILENO, /* tty_path= */ NULL);
(void) exec_context_apply_tty_size(context, STDIN_FILENO, STDIN_FILENO, /* tty_path= */ NULL);
}
return STDIN_FILENO;
@@ -389,7 +389,7 @@ static int setup_input(
if (tty_fd < 0)
return tty_fd;
r = exec_context_apply_tty_size(context, tty_fd, tty_path);
r = exec_context_apply_tty_size(context, tty_fd, tty_fd, tty_path);
if (r < 0)
return r;
@@ -679,7 +679,7 @@ static int setup_confirm_stdio(
if (r < 0)
return r;
r = exec_context_apply_tty_size(context, fd, vc);
r = exec_context_apply_tty_size(context, fd, fd, vc);
if (r < 0)
return r;