isaacs / cluster-master

Take advantage of node built-in cluster module behavior
ISC License
276 stars 44 forks source link

`args` property of config is being ignored #6

Closed mikefrey closed 12 years ago

mikefrey commented 12 years ago

The args property of the config object passed into clusterMaster to start the cluster is ignored. This PR fixes the issue. Here is a test case:

var cluster = require('cluster')
var clusterMaster = require('../cluster-master')

if (cluster.isMaster) {
  clusterMaster({
    exec: __filename,
    args: ['--some', 'args', 'here'],
    size: 2
  })
} else {
  var args = process.argv.slice(2)
  if (args.length > 0)
    console.log('Worker args:', args)
  else
    console.log('No worker args!')
}
rikkert commented 12 years ago

+1

I would replace the line: if (config.env) masterConf.env = config.env with your line because cluster.setupMaster does not use the env property.

isaacs commented 12 years ago

Landed in master.