Skip to content

rnons/fork-aff-issue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dev

spago build
spago run

The code

  traceM "hanlder start"
  void $ Aff.forkAff $ do
    -- output is differnt with / without Aff.delay
    -- Aff.delay $ Aff.Milliseconds 0.0
    traceM "fork start"
    buffer <- liftEffect $ ChildProcess.execSync
      "echo fork running"
      ChildProcess.defaultExecSyncOptions
    liftEffect $ Buffer.toString UTF8 buffer >>= \msg ->
      traceM msg
  traceM "hanlder finish"

The output

Without Aff.delay, I get

'hanlder start'
'fork start'
'fork running\n'
'hanlder finish'

With Aff.delay, I get

'hanlder start'
'hanlder finish'
'fork start'
'fork running\n'

This is the desired behavior, however, not sure why Aff.delay 0 is needed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published