Skip to content

Commit

Permalink
Merged CleverStack/hotfix/delimit-node-path-windows
Browse files Browse the repository at this point in the history
  • Loading branch information
pilsy committed Jun 7, 2014
2 parents 914d12c + f254812 commit f3cbc5a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ var cluster = require( 'cluster' )
, config = require( './config' )
, packageJson = require( './package.json' )
, path = require( 'path' )
, os = require( 'os' )
, isWin = /^win32/.test( os.platform() )
, fs = require( 'fs' );

function loadModulesAppFiles( moduleName ) {
Expand All @@ -13,8 +15,10 @@ function loadModulesAppFiles( moduleName ) {
});
}

// Set the node path - this works only because the other processes are forked.
process.env.NODE_PATH = process.env.NODE_PATH ? './lib/:./modules/:' + process.env.NODE_PATH : './lib/:./modules/';
// Set the node path - this works only because the other processes are forked. (Be sure to use the right delimiter)
process.env.NODE_PATH = process.env.NODE_PATH
? [ './lib/', './modules', process.env.NODE_PATH ].join( isWin ? ';' : ':' )
: [ './lib/', './modules' ].join( isWin ? ';' : ':' );

if ( cluster.isMaster ) {
cluster.on('exit', function( worker, code, signal ) {
Expand Down

0 comments on commit f3cbc5a

Please sign in to comment.