@mindexec/cli 0.2.497 → 0.2.498

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.
@@ -81,21 +81,18 @@ for (const entry of nativeRendererManifest.files) {
81
81
  `Packaged native renderer SHA-256 drifted for ${entry.path}.`);
82
82
  }
83
83
 
84
- function reservePort() {
85
- return new Promise((resolve, reject) => {
86
- const server = net.createServer();
87
- server.once('error', reject);
88
- server.listen({ host: '127.0.0.1', port: 0, exclusive: true }, () => {
89
- const address = server.address();
90
- server.close((error) => {
91
- if (error) {
92
- reject(error);
93
- return;
94
- }
95
- resolve(address.port);
84
+ async function reservePort(startPort) {
85
+ for (let port = startPort; port < startPort + 100; port += 1) {
86
+ const available = await new Promise((resolve) => {
87
+ const server = net.createServer();
88
+ server.once('error', () => resolve(false));
89
+ server.listen({ host: '127.0.0.1', port, exclusive: true }, () => {
90
+ server.close((error) => resolve(!error));
96
91
  });
97
92
  });
98
- });
93
+ if (available) return port;
94
+ }
95
+ throw new Error(`No free packaged-smoke port was found from ${startPort}.`);
99
96
  }
100
97
 
101
98
  async function waitForFile(filePath, child, timeoutMs) {
@@ -164,8 +161,11 @@ async function waitForProcessExit(processId, timeoutMs) {
164
161
  return !processExists(processId);
165
162
  }
166
163
 
167
- const bridgePort = await reservePort();
168
- const remoteHubPort = await reservePort();
164
+ // Chromium rejects a small set of otherwise valid TCP ports (for example
165
+ // 10080). Use a known-safe test range instead of accepting any ephemeral port
166
+ // that Windows happens to return.
167
+ const bridgePort = await reservePort(18_080);
168
+ const remoteHubPort = await reservePort(bridgePort + 1);
169
169
  const smokeRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'mindexec-electron-smoke-'));
170
170
  const workspace = path.join(smokeRoot, 'saved-workspace');
171
171
  const resultPath = path.join(smokeRoot, 'result.json');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindexec/cli",
3
- "version": "0.2.497",
3
+ "version": "0.2.498",
4
4
  "description": "MindExec local runtime and bridge CLI",
5
5
  "main": "server.js",
6
6
  "type": "module",