Skip to content

Wasm backend support for `hSetBuffering stdin NoBuffering` results in `setCooked` error

Summary

Using hSetBuffering stdin NoBuffering results in setCooked error withh the wasm backend.

Steps to reproduce

This program:

import System.IO
main = do
  hSetBuffering stdin NoBuffering
  putStrLn "hello"

Fails with:

$ wasm32-wasi-ghc hello.hs -o hello.wasm
[1 of 2] Compiling Main             ( hello.hs, hello.o ) [Source file changed]
[2 of 2] Linking hello.wasm [Objects changed]
$ wasmtime ./hello.wasm

hello.wasm: setCooked

Expected behavior

The program should print "hello"

Environment

  • GHC version used: The Glorious Glasgow Haskell Compilation System, version 9.7.20230208

Optional:

  • Operating System: Fedora 37 Linux
  • System Architecture: x86-64
  • wasmtime-cli 5.0.0
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information