https://github.com/rnons/fork-aff-issue
https://github.com/rnons/fork-aff-issue
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rnons/fork-aff-issue
- Owner: rnons
- Created: 2019-10-14T07:28:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-14T07:35:45.000Z (over 6 years ago)
- Last Synced: 2025-07-05T08:43:21.327Z (12 months ago)
- Language: Dhall
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Dev
```
spago build
spago run
```
## The code
```purescript
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.