AJ ONeal
6 years ago
3 changed files with 54 additions and 8 deletions
@ -0,0 +1,20 @@ |
|||
'use strict'; |
|||
|
|||
var os = require('os'); |
|||
var net = require('net'); |
|||
var ipc = { |
|||
path: /^win/.test(os.platform()) ? '\\\\.\\pipe\\X:/name/of/pipe' : (__dirname + '/tmp.sock') |
|||
}; |
|||
var oldUmask = process.umask(0x0000); |
|||
var server = net.createServer(); |
|||
|
|||
server.listen({ |
|||
path: ipc.path || null |
|||
, host: 'localhost' |
|||
, port: ipc.port || null |
|||
, writeableAll: true |
|||
, readableAll: true |
|||
}, function () { |
|||
process.umask(oldUmask); |
|||
console.log("Listening on", this.address()); |
|||
}); |
@ -0,0 +1,22 @@ |
|||
'use strict'; |
|||
|
|||
var path = require('path'); |
|||
var spawn = require('child_process').spawn; |
|||
var args = [ |
|||
path.join(__dirname, 'windows-pipe.js') |
|||
]; |
|||
var subprocess = spawn( |
|||
'node' |
|||
, args |
|||
, { detached: true |
|||
, stdio: [ 'ignore', process.stdout, process.stderr ] |
|||
} |
|||
); |
|||
//console.log('[debug]', vars.telebitNode, args.join(' '));
|
|||
subprocess.unref(); |
|||
subprocess.on('error', function (_err) { |
|||
console.error(_err); |
|||
}); |
|||
subprocess.on('exit', function (code, signal) { |
|||
console.error('' + code + ' ' + signal + ' failure to launch'); |
|||
}); |
Loading…
Reference in new issue