From f38f5be4312ca8e08955aaa68d97bda2435b34ac Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Wed, 10 Jun 2026 09:15:35 +0000 Subject: [PATCH] fix(test): close echo race in the kitty detach integration test waitFor(KITTY-APP) could match the tty echo of the typed printf command, since the marker appeared literally in the command line. On slow runners the detach keys were then sent before the app enabled kitty keyboard mode, leaked into the window, and the test timed out waiting for a detach that never happened. Assemble the marker from two printf arguments so the echo never contains it, and print it after the kitty enable so visibility of the marker implies the daemon has processed the enable. --- test/integration.zig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/integration.zig b/test/integration.zig index 99d6daf..5e761d8 100644 --- a/test/integration.zig +++ b/test/integration.zig @@ -947,8 +947,13 @@ test "kitty keyboard apps: encoded C-a still detaches" { // The app enters the alt screen and enables kitty keyboard // disambiguation, like a modern TUI. The passthrough mirrors both // onto the client's terminal, which then encodes Ctrl+A as - // CSI 97;5u instead of 0x01. - try client.send("printf '\\033[?1049h\\033[H\\033[2JKITTY-APP\\n\\033[>1u'; read x\r"); + // CSI 97;5u instead of 0x01. The marker is printed after the + // kitty enable and assembled from two printf arguments: by the + // time it is visible the daemon has processed the enable, and the + // echoed command line never contains the assembled marker (the + // tty echo would otherwise satisfy the wait while the keys still + // leak into the window). + try client.send("printf '\\033[?1049h\\033[H\\033[2J\\033[>1uKITTY-%s\\n' APP; read x\r"); try client.waitFor("KITTY-APP"); // Press C-a d the way a kitty-mode terminal sends it.