Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 1 commit
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 20 additions and 4 deletions.
  1. +4 −0 README.md
  2. +16 −4 bin/up
View
4 README.md
@@ -55,6 +55,10 @@ The `up` command accepts the following options:
- the port to listen on. Not required if the module already `listen`s.
- Defaults to `3000`.
+- `-s`/`--socketpath`
+ - the unix domain socket path to listen on.
+ - Cannot be set if port is specified.
+
- `-w`/`--watch`
- Whether to watch for changes.
View
20 bin/up
@@ -35,7 +35,8 @@ var cpus = require('os').cpus().length;
program
.version(up.version)
.usage('[options] <file>')
- .option('-p, --port <port>', 'Port to listen on.', 3000)
+ .option('-p, --port <port>', 'Port to listen on.')
+ .option('-s, --socketpath <socketpath>', 'Socket path to listen on.')
.option('-f, --pidfile <pidfile>', 'Write port to pidfile')
.option('-w, --watch', 'Watch the module directory for changes.')
.option('-r, --require <file>', 'Module to require from each worker.')
@@ -103,7 +104,18 @@ if (!(server instanceof http.Server)) {
var port;
-if (null != program.port) {
+if (null != program.port && null != program.socketpath) {
+ error('\n Cannot specify both port and socketpath');
+}
+
+
+if (null == program.port) {
+ if (null == program.socketpath) {
+ port = 3000;
+ } else {
+ port = program.socketpath;
+ }
+} else {
port = Number(program.port);
if (!port || isNaN(port)) {
@@ -137,11 +149,11 @@ if (null != workerTimeout && isNaN(ms(workerTimeout))) {
* Start!
*/
-debug('starting cluster with %d workers on port %d', numWorkers, port);
+debug('starting cluster with %d workers on port %s', numWorkers, port);
debug('`\033[97mkill -s SIGUSR2 %d\033[90m` or \033[97mctrl + r\033[90m'
+ ' to load new code', process.pid);
-var httpServer = http.Server().listen(program.port)
+var httpServer = http.Server().listen(port)
, srv = up(httpServer, file, {
numWorkers: numWorkers
, workerTimeout: workerTimeout

No commit comments for this range

Something went wrong with that request. Please try again.