From b8e104015e35ebecc712cbf6cc585eee86cfd97e Mon Sep 17 00:00:00 2001 From: Icemap Date: Sat, 11 Nov 2023 00:38:54 +0800 Subject: [PATCH] feat: cwriter for wasm v7 --- cwriter/util_wasm.go | 6 ++++++ cwriter/writer_posix.go | 2 +- cwriter/writer_wasm.go | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 cwriter/util_wasm.go create mode 100644 cwriter/writer_wasm.go diff --git a/cwriter/util_wasm.go b/cwriter/util_wasm.go new file mode 100644 index 00000000..7efaa619 --- /dev/null +++ b/cwriter/util_wasm.go @@ -0,0 +1,6 @@ +//+build wasm js + +package cwriter + +// There is no ioctl on wasm, so we just use a dummy value. +const ioctlReadTermios = 0 diff --git a/cwriter/writer_posix.go b/cwriter/writer_posix.go index f54a5d06..764bd97b 100644 --- a/cwriter/writer_posix.go +++ b/cwriter/writer_posix.go @@ -1,4 +1,4 @@ -// +build !windows +// +build !windows,!wasm,!js package cwriter diff --git a/cwriter/writer_wasm.go b/cwriter/writer_wasm.go new file mode 100644 index 00000000..360841df --- /dev/null +++ b/cwriter/writer_wasm.go @@ -0,0 +1,15 @@ +// +build wasm js + +package cwriter + +// Don't overwrite clearLines() + +// GetSize do nothing +func GetSize(fd int) (width, height int, err error) { + return 0, 0, nil +} + +// IsTerminal do nothing +func IsTerminal(fd int) bool { + return true +}