@streamorchard/grapevine 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +8 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamorchard/grapevine",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Lets desktop apps on the same computer find each other and talk, privately: local sockets, JSON-RPC, pairing and versioned capabilities.",
5
5
  "license": "GPL-3.0-only",
6
6
  "author": "StreamOrchard",
package/src/index.js CHANGED
@@ -99,7 +99,14 @@ class Link extends EventEmitter {
99
99
  const server = net.createServer((socket) => this.accept(socket));
100
100
  const go = () =>
101
101
  server.listen(this.socketPath, () => {
102
- if (platform !== 'win32') fs.chmodSync(this.socketPath, 0o600);
102
+ // The socket can vanish before this runs (its folder removed): start() fails, rather than
103
+ // an exception the app can't catch.
104
+ try {
105
+ if (platform !== 'win32') fs.chmodSync(this.socketPath, 0o600);
106
+ } catch (err) {
107
+ server.close();
108
+ return reject(err);
109
+ }
103
110
  this.server = server;
104
111
  resolve();
105
112
  });