core: also issue OSC 3008 from service context

(Note: we also change TEST-13-NSPAWN.machined.sh minimally here, because
it checks for byte precise output of a pty allocated for a service
invocation - which it's not going to get if it claims that the pty is an
all-powerful one. After all this PR ensures that we'll generate the new
OSC sequence on non-dumb terminals associated with services. Hence, set
TERM=dumb explicitly to ensure no ANSI sequences are generated, ever.
Which is a nice test btw that TERM=dumb really does its thing here.)
This commit is contained in:
Lennart Poettering
2025-02-27 15:17:34 +01:00
parent 5b3eaf9e68
commit bbdad5c025
5 changed files with 34 additions and 9 deletions
+8 -2
View File
@@ -46,6 +46,7 @@
#include "missing_securebits.h"
#include "missing_syscall.h"
#include "mkdir-label.h"
#include "osc-context.h"
#include "proc-cmdline.h"
#include "process-util.h"
#include "psi-util.h"
@@ -4386,6 +4387,9 @@ static void prepare_terminal(
}
(void) exec_context_apply_tty_size(context, STDIN_FILENO, STDOUT_FILENO, /* tty_path= */ NULL);
if (use_ansi)
(void) osc_context_open_service(p->unit_id, p->invocation_id, /* ret_seq= */ NULL);
}
int exec_invoke(
@@ -4562,8 +4566,10 @@ int exec_invoke(
* disallocate the VT), to get rid of any prior uses of the device. Note that we do not keep any fd
* open here, hence some of the settings made here might vanish again, depending on the TTY driver
* used. A 2nd ("constructive") initialization after we opened the input/output fds we actually want
* will fix this. */
exec_context_tty_reset(context, params);
* will fix this. Note that we pass a NULL invocation ID here – as exec_context_tty_reset() expects
* the invocation ID associated with the OSC 3008 context ID to close. But we don't want to close any
* OSC 3008 context here, and opening a fresh OSC 3008 context happens a bit further down. */
exec_context_tty_reset(context, params, /* invocation_id= */ SD_ID128_NULL);
if (params->shall_confirm_spawn && exec_context_shall_confirm_spawn(context)) {
_cleanup_free_ char *cmdline = NULL;