Support iisnode using named pipes as PORT value

Port can't be number checked to support iisnode. Using a parseInt()
or number isNumber function won't work if we want to support iisnode
which uses named pipes for ports (ex. \\.\pipe\mypipe)
This commit is contained in:
Jonathan Sheely 2015-04-29 16:37:26 -04:00 committed by Miroslav Bajtoš
parent 140180f667
commit 44f733f59f
2 changed files with 7 additions and 4 deletions

View File

@ -115,7 +115,9 @@ function setPort(app, instructions) {
process.env.npm_package_config_port,
app.get('port'),
3000
], isFinite);
], function(p) {
return p != null;
});
if (port !== undefined) {
var portType = typeof port;

View File

@ -417,10 +417,11 @@ describe('executor', function() {
assert.equal(app.get('port'), 3000);
});
it('should ignore non-numeric port values in ENV', function() {
process.env.PORT = '123invalid';
it('should respect named pipes port values in ENV', function() {
var NAMED_PORT = '\\.\\pipe\\test';
process.env.PORT = NAMED_PORT;
boot.execute(app, someInstructions({ config: { port: 3000 } }));
assert.equal(app.get('port'), 3000);
assert.equal(app.get('port'), NAMED_PORT);
});
});