From 1b5b7ffce07d81ab474360dbc4a0620273b5acb0 Mon Sep 17 00:00:00 2001 From: Sebastiaan Koppe Date: Wed, 28 May 2025 17:20:51 +0200 Subject: [PATCH] feat(terminal): Add temp bindings to support musl Druntime is missing the tcgetattr/tcsetattr binding for musl. Here we add them to allow building on musl. --- terminal.d | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/terminal.d b/terminal.d index 9f3ec97..81e8476 100644 --- a/terminal.d +++ b/terminal.d @@ -388,6 +388,16 @@ version(Posix) { import core.sys.posix.sys.ioctl; } +version(CRuntime_Musl) { + // Druntime currently doesn't have bindings for termios on Musl. + // We define our own bindings whenever the import fails. + // When druntime catches up, this block can slowly be removed, + // although for backward compatibility we might want to keep it. + static if (!__traits(compiles, import core.sys.posix.termios : tcgetattr)) { + int tcgetattr (int, struct termios *); + int tcsetattr (int, int, const struct termios *); + } +} version(VtEscapeCodes) {