npm package: "cluster-master" fails on Windows (REPL). But why does it even include a REPL (which is not supported on all platforms)?

79 views
Skip to first unread message

Fredrik O

unread,
Oct 27, 2012, 8:08:39 AM10/27/12
to nod...@googlegroups.com
I am writing this post here because I don´t know anywhere else I should write it. It is about the npm package: "cluster-master" (https://npmjs.org/package/cluster-master).

I have precise notice that the package is not supported on windows. It surprised me much. When I checked the source code and did some quick testing I found out that it is the "setupRepl" function which is failing, more specific when it tries to listen on a "string", e.g. a "unix domain socket" I got error "listen EACCES". It fails because this feature is not available on windows. This is not a new bug/issue: https://github.com/joyent/node/issues/3827

So I wondering, why does the cluster-master package even create a Repl sever on the first place? It should in my opinion be best handled by the user, if it want it and thereafter how it want to implement it. It should not require many lines of code, no matter how:

var clusterMaster = require('cluster-master'),
     _ = require('underscore');

var server = dnode({
     resize: _.bind(clusterMaster.resize, clusterMaster),
     restart: _.bind(clusterMaster.restart, clusterMaster),
     quit: _.bind(clusterMaster.quit, clusterMaster),
     quitHard: _.bind(clusterMaster.quitHard, clusterMaster)
});

server.listen(8723);


PS. I assume it is completely safe to remove the setupRepl function, it is correct, isn't it?


Thanks in advance!

Bert Belder

unread,
Oct 28, 2012, 2:11:48 PM10/28/12
to nod...@googlegroups.com
I'm not the author of cluster-master, so I'll leave it to him/her to explain his design decisions. 

However I think that if you change the domain socket "path" to a valid named pipe name, it'll just work. Try something like \\.\pipe\mypipename". (Note that you have to escape the backslashes in JS, so that'd become '\\\\.\\pipe\\mypipename').

- Bert

Fredrik O

unread,
Oct 29, 2012, 2:52:22 PM10/29/12
to nod...@googlegroups.com
Thanks for answer Bert!

I know, Isaac is :-) Good tip,  however I don´t want a REPL there anyway so I have completely removed it, or to be exactly just wrote a return statement as first statement in the setupRepl. Minimal effort required :-)
Reply all
Reply to author
Forward
0 new messages