mirror of
https://git.coolaj86.com/coolaj86/telebit.js.git
synced 2024-11-20 12:34:41 +00:00
don't define host and port, even as null
This commit is contained in:
parent
219166670b
commit
8f7ab08a99
@ -571,17 +571,21 @@ function serveControlsHelper() {
|
||||
// mask is so that processes owned by other users
|
||||
// can speak to this process, which is probably root-owned
|
||||
var oldUmask = process.umask(0x0000);
|
||||
var serverOpts = {
|
||||
writableAll: true
|
||||
, readableAll: true
|
||||
, exclusive: false
|
||||
};
|
||||
if ('socket' === state._ipc.type) {
|
||||
require('mkdirp').sync(path.dirname(state._ipc.path));
|
||||
}
|
||||
controlServer.listen({
|
||||
path: state._ipc.path || null
|
||||
, host: 'localhost'
|
||||
, port: state._ipc.port || null
|
||||
, writableAll: true
|
||||
, readableAll: true
|
||||
, exclusive: false
|
||||
}, function () {
|
||||
if (state._ipc.port) {
|
||||
serverOpts.host = 'localhost';
|
||||
serverOpts.port = state._ipc.port;
|
||||
} else {
|
||||
serverOpts.path = state._ipc.path;
|
||||
}
|
||||
controlServer.listen(serverOpts, function () {
|
||||
process.umask(oldUmask);
|
||||
var address = this.address();
|
||||
if (address.port) {
|
||||
|
20
tests/windows-pipe.js
Normal file
20
tests/windows-pipe.js
Normal file
@ -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());
|
||||
});
|
22
tests/windows-spawn-pipe.js
Normal file
22
tests/windows-spawn-pipe.js
Normal file
@ -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
Block a user