Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: OSC133 outputs shouldn't be printed in non-interactive mode
- X-seq: zsh-workers 55080
- From: Daniel Colascione <dancol@xxxxxxxxxx>
- To: Oliver Kiddle <opk@xxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: OSC133 outputs shouldn't be printed in non-interactive mode
- Date: Mon, 10 Aug 2026 01:42:26 -0400
- Archived-at: <https://zsh.org/workers/55080>
- In-reply-to: <5671-1784543685.055924@gnXh.N4Op.rp7->
- List-id: <zsh-workers.zsh.org>
- References: <87qzl89e2z.fsf@dancol.org> <70628-1784025447.627343@Z2lq.Pt4z.cuLS> <87fr1ly0ym.fsf@dancol.org> <75367-1784064985.901251@BG3L.z84d.W3M5> <875x2ex4g1.fsf@dancol.org> <5671-1784543685.055924@gnXh.N4Op.rp7->
Oliver Kiddle <opk@xxxxxxx> writes:
> On 16 Jul, Daniel Colascione wrote:
>> +++ b/Test/X06termquery.ztst
>
>> + sleep 0.1
>
> Thanks for adding the test case.
>
> Unfortunately, I don't think fractional values with sleep is portable.
> And it isn't a builtin so we depend on the system. There have been
> recent changes from others to avoid delays on other tests. Is there some
> solution that might be applued here?
>
> Oliver
Yes, we can make it much simpler. How's this version?
commit 44d3a6b3cd906e10f9bc183adf04b0e57d0fb9ad
Author: Daniel Colascione <dancol@xxxxxxxxxx>
Date: Sun Jul 12 15:52:40 2026 -0400
Avoid OSC 133 markers in noninteractive shells
diff --git a/Src/init.c b/Src/init.c
index f36bc332b..10802669c 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -224,7 +224,7 @@ loop(int toplevel, int justonce)
*/
errflag &= ~ERRFLAG_ERROR;
}
- if (toplevel && zle_load_state == 1)
+ if (interact && toplevel && zle_load_state == 1)
zleentry(ZLE_CMD_PREEXEC);
if (stopmsg) /* unset 'you have stopped jobs' flag */
stopmsg--;
@@ -232,7 +232,7 @@ loop(int toplevel, int justonce)
tok = toksav;
if (toplevel) {
noexitct = 0;
- if (zle_load_state == 1)
+ if (interact && zle_load_state == 1)
zleentry(ZLE_CMD_POSTEXEC);
}
}
diff --git a/Test/X06termquery.ztst b/Test/X06termquery.ztst
index 701cd625b..becf63c51 100644
--- a/Test/X06termquery.ztst
+++ b/Test/X06termquery.ztst
@@ -19,6 +19,19 @@
{ zpty -r zsh } | tr -d '\015' | grep -v '^ '
zpty -d
}
+ noninteractive_integration() {
+ local REPLY chunk out=
+ zpty -d
+ zpty zsh "${(q)ZTST_testdir}/../Src/zsh +i -f"
+ zpty -w zsh "module_path=( ${(j< >)${(@q-)module_path}} \$module_path )"
+ zpty -w zsh 'zmodload zsh/zle && print -r -- PAYLOAD'
+ zpty -w zsh exit
+ while zpty -r zsh chunk; do
+ out+=$chunk
+ done
+ zpty -d
+ [[ $out == *PAYLOAD* && $out != *$'\e]133;'* ]]
+ }
else
ZTST_unimplemented='the zsh/zpty module is not available'
fi
@@ -106,6 +119,9 @@
>replace
>typeset -a .term.extensions=( -bracketed-paste -integration )
+ noninteractive_integration
+0:Noninteractive shells do not emit OSC 133 markers after loading ZLE
+
%clean
zmodload -ui zsh/zpty
Messages sorted by:
Reverse Date,
Date,
Thread,
Author