Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cwriter: add the blank wasm util and writer for building pass #132

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions cwriter/util_wasm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//go:build wasm || js

package cwriter

// There is no ioctl on wasm, so we just use a dummy value.
const ioctlReadTermios = 0
2 changes: 1 addition & 1 deletion cwriter/writer_posix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !windows
//go:build !windows && !js && !wasm

package cwriter

Expand Down
21 changes: 21 additions & 0 deletions cwriter/writer_wasm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//go:build js || wasm

package cwriter

// We can not use writer in wasm, so we just use a dummy value.
type Writer struct {
}

func (w *Writer) Flush(lines int) error {
return nil
}

// GetSize returns the dimensions of the given terminal.
func GetSize(fd int) (width, height int, err error) {
return 0, 0, nil
}

// IsTerminal returns whether the given file descriptor is a terminal.
func IsTerminal(fd int) bool {
return true
}