Skip to content

Instantly share code, notes, and snippets.

@koichik
Created March 15, 2013 12:56
Show Gist options
  • Save koichik/5169720 to your computer and use it in GitHub Desktop.
Save koichik/5169720 to your computer and use it in GitHub Desktop.
var s = '';
for (var i = 0; i < 1E5; ++i) s += 'あ';
process.send(s);
var assert = require('assert');
var child = require('child_process').fork(__dirname + '/child.js');
child.on('message', function(s) {
for (var i = 0, len = s.length; i < len; ++i)
assert.equal(s[i], 'あ');
child.kill();
});
$ node -v
v0.8.22
$ node parent.js
assert.js:102
throw new assert.AssertionError({
^
AssertionError: "�" == "あ"
at ChildProcess.<anonymous> (/tmp/parent.js:5:12)
at ChildProcess.EventEmitter.emit (events.js:99:17)
at handleMessage (child_process.js:273:12)
at Pipe.channel.onread (child_process.js:293:9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment