wasi: improve stdin support for nonblocking, fix stdout (#1542)
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
This commit is contained in:
@@ -69,6 +69,17 @@ type stdioFile struct {
|
||||
st fsapi.Stat_t
|
||||
}
|
||||
|
||||
// SetAppend implements File.SetAppend
|
||||
func (f *stdioFile) SetAppend(bool) syscall.Errno {
|
||||
// Ignore for stdio.
|
||||
return 0
|
||||
}
|
||||
|
||||
// IsAppend implements File.SetAppend
|
||||
func (f *stdioFile) IsAppend() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsDir implements File.IsDir
|
||||
func (f *stdioFile) IsDir() (bool, syscall.Errno) {
|
||||
return false, 0
|
||||
|
||||
@@ -131,6 +131,16 @@ func TestFileSetAppend(t *testing.T) {
|
||||
requireFileContent("wazero6789wazero")
|
||||
}
|
||||
|
||||
func TestStdioFile_SetAppend(t *testing.T) {
|
||||
// SetAppend should not affect Stdio.
|
||||
file, err := NewStdioFile(false, os.Stdout)
|
||||
require.NoError(t, err)
|
||||
errno := file.SetAppend(true)
|
||||
require.EqualErrno(t, 0, errno)
|
||||
_, errno = file.Write([]byte{})
|
||||
require.EqualErrno(t, 0, errno)
|
||||
}
|
||||
|
||||
func TestFileIno(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
dirFS, embedFS, mapFS := dirEmbedMapFS(t, tmpDir)
|
||||
|
||||
Reference in New Issue
Block a user