LearnBoost / cluster

Node.JS multi-core server manager with plugins support.

Home Page:http://learnboost.github.com/cluster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Server is detached from the tty when cluster.reload kicks in

papandreou opened this issue · comments

Given a simple server:

// helloworld.js
var server = require('http').createServer(function (req, res) {
    res.writeHead(200, {'content-type': 'text/plain'});
    res.end('Hello, world!');
});

var cluster = require('cluster');

cluster(server)
    .use(cluster.reload('.'))
    .listen(3000);

console.warn("Listening on port 3000...");

I start it from my terminal, then run "touch helloworld.js" in another terminal:

andreas@papandreou:~/helloworld$ node helloworld.js 
Listening on port 3000...
Listening on port 3000...
Listening on port 3000...
Listening on port 3000...
Listening on port 3000...
andreas@papandreou:~/helloworld$ 

And now the server is suddenly running in the background, which is confusing and a bit annoying, because I can no longer kill it with CTRL+C.

Would it be possible to get it the server to stay foregrounded?

I'm using Cluster 0.7.1 and node.js 0.4.10 on Ubuntu 10.10.

Best regards,
Papandreou

+1

I think this would have to do with not reloading the "master" process, only the workers. If that's the case it should be an opt-in option.

changed this, it wont reload your config for master then but yeah I agree it's less of a PITA