You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On my system (macOS 10.12.5, GHC 8.0.2, silently 1.2.5) this produces the output:
"from haskell\n"
""
from C
So I figured that was that, silently only works for Haskell code. Not sure why the C printf comes after the Haskell print but chalked it up to buffering weirdness. But then I modified main to look like this:
I can reproduce this as of 2022-08-20 (GHC 9.4.1).
I don't know the FFI enough to be able to comprehend this behavior.
But I experienced capture failures of stderr on Windows which I could fix using evaluate. However, in this case evaluate did not help (the cFunc returns (), nothing to evaluate here).
Is there literature how the FFI handles I/O? Didn't find anything...
cfunc.c:
Main.hs:
On my system (macOS 10.12.5, GHC 8.0.2, silently 1.2.5) this produces the output:
So I figured that was that, silently only works for Haskell code. Not sure why the C printf comes after the Haskell print but chalked it up to buffering weirdness. But then I modified main to look like this:
And that produces this output:
So if I have C code print at least once to stdout, then thereafter it can be captured by silently...? I don't understand why at all. Any insight?
The text was updated successfully, but these errors were encountered: