Created
January 20, 2013 05:15
-
-
Save tiye/4576784 to your computer and use it in GitHub Desktop.
Comfirm that when forking a process, object is copied not pointed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = | |
a: 'new' | |
b: 'should change' | |
call = -> | |
process.send a | |
setTimeout call, 1000 | |
log = console.log | |
do print = -> | |
log a | |
setTimeout print, 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fork = require 'child_process' | |
child = fork.fork 'callee.coffee' | |
log = console.log | |
child.on 'message', (data) -> | |
log 'data', data | |
data.c = 'chan' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment