Spago run never terminate for my ffi

I have the following code:

In SomeCode.js

exports.runnerImpl = function (arg) {
    return function no() {
        console.log("This should show " + arg);

In SomeCode.purs

foreign import runnerImpl:: String -> Effect Unit
runner :: String -> Effect Unit
runner = runnerImpl

In Main.purs

main :: Effect Unit
main = launchAff_ do
  liftEffect $ runner "HOHOHO"

Now if I run spago run it will print This should show HOHOHO as expected and then it will do nothing (that is it will not terminate until I press ctrl-c).
Why is this happening? If i run native purescript code with the same type as runnerImpl things work as expected.

1 Like

Hmmm I cannot reproduce, spago run exits automatically for me. Is that exactly the code you are running? Are you importing anything in Aff instead of Effect?

What do you mean with " Are you importing anything in Aff instead of Effect ?"?

Sorry, I forgot to reply. Are you using the FFI to import Aff actions at all? Like via makeAff or anything? I could see that being responsible for hanging node if I went wrong, but Effect shouldn’t hang node.