git ssb

0+

cel-desktop / ssb-pkg



Tree: c5c7a8ffadbd51aa28a5f3f096fe43f69405da44

Files: c5c7a8ffadbd51aa28a5f3f096fe43f69405da44 / test / test-50-spawn / test-cluster.js

492 bytesRaw
1#!/usr/bin/env node
2
3'use strict';
4
5var assert = require('assert');
6var cluster = require('cluster');
7var child;
8
9if (process.send) {
10 require('./test-cluster-child.js');
11 return;
12}
13
14assert(cluster.isMaster);
15
16try {
17 child = cluster.fork();
18} catch (e) {
19 console.log(e.message);
20}
21
22child.on('message', function (value) {
23 console.log(value.toString());
24 child.send(value);
25});
26
27child.send(2);
28
29cluster.on('exit', function (_, code) {
30 console.log('Child exited with code', code);
31});
32

Built with git-ssb-web