Permalink
Browse files

fixed socket permissions bug

  • Loading branch information...
1 parent 1ac8383 commit 8dfd4824c98377e36275784cd9f9d3c60912809e @olalonde committed Mar 31, 2011
Showing with 7 additions and 9 deletions.
  1. +1 −1 README.md
  2. +6 −8 ttychat-server.js
View
@@ -1,6 +1,6 @@
# Requirements #
-1. [Node.js](http://nodejs.org/)
+1. [Node.js](http://nodejs.org/) (tested on v0.5.0-pre)
# Usage #
View
@@ -2,6 +2,7 @@
var util = require('util'),
net = require('net'),
+ fs = require('fs'),
exec = require('child_process').exec;
Array.prototype.remove = function(e) {
@@ -62,12 +63,9 @@ var server = net.createServer(function (socket) {
});
});
-// Create socket file
-exec('nc -U ' + socket_path, function () {
- exec('chmod 777 ' + socket_path, function () {
- // Start server
- server.listen(socket_path, function() {
- util.log('Server started. Waiting for connections on ' + socket_path);
- });
- });
+// Start server
+server.listen(socket_path, function() {
+ util.log('Server started. Waiting for connections on ' + socket_path);
+ fs.chmod(socket_path, "0777");
});
+

0 comments on commit 8dfd482

Please sign in to comment.