Skip to content

Commit 8f3d584

Browse files
authored
Merge pull request adamdruppe#505 from skoppe/tcsetattr_musl
feat(terminal): Add bindings to support musl
2 parents 71d4934 + 1b5b7ff commit 8f3d584

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

terminal.d

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,16 @@ version(Posix) {
388388

389389
import core.sys.posix.sys.ioctl;
390390
}
391+
version(CRuntime_Musl) {
392+
// Druntime currently doesn't have bindings for termios on Musl.
393+
// We define our own bindings whenever the import fails.
394+
// When druntime catches up, this block can slowly be removed,
395+
// although for backward compatibility we might want to keep it.
396+
static if (!__traits(compiles, import core.sys.posix.termios : tcgetattr)) {
397+
int tcgetattr (int, struct termios *);
398+
int tcsetattr (int, int, const struct termios *);
399+
}
400+
}
391401

392402
version(VtEscapeCodes) {
393403

0 commit comments

Comments
 (0)