make sharding manager constructor better (#794)

* add color stuff to support popular color libraries

* make this better

* fix docs
This commit is contained in:
Gus Caplan
2016-10-11 19:20:59 -05:00
committed by Schuyler Cebulskie
parent 96355a4968
commit 0de3d1bfc4
3 changed files with 23 additions and 13 deletions

View File

@@ -10,8 +10,9 @@ class Shard {
/**
* @param {ShardingManager} manager The sharding manager
* @param {number} id The ID of this shard
* @param {array} [spawnArgs=] Optional command line arguments to pass to the shard
*/
constructor(manager, id) {
constructor(manager, id, spawnArgs = []) {
/**
* Manager that created the shard
* @type {ShardingManager}
@@ -28,7 +29,7 @@ class Shard {
* Process of the shard
* @type {ChildProcess}
*/
this.process = childProcess.fork(path.resolve(this.manager.file), [], {
this.process = childProcess.fork(path.resolve(this.manager.file), spawnArgs, {
env: {
SHARD_ID: this.id,
SHARD_COUNT: this.manager.totalShards,