Skip to content

Instantly share code, notes, and snippets.

@MylesBorins
Last active May 20, 2016 19:07
Show Gist options
  • Save MylesBorins/d2a82b014d3cfe9b871bb401d11fccd4 to your computer and use it in GitHub Desktop.
Save MylesBorins/d2a82b014d3cfe9b871bb401d11fccd4 to your computer and use it in GitHub Desktop.
Child process argv
const http = require('http');
const server = http.createServer((req, res) => {
res.end();
});
server.on('clientError', (err, socket) => {
socket.end('HTTP/1.1 400 Bad Request\r\n\r\n');
});
server.listen(process.argv[2]);
var fork = require('child_process').fork;
var child = fork(__dirname + '/child.js', ['8000']);
var childToo = fork(__dirname + '/child.js', ['8080']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment