attio 0.0.1-experimental.20250325 → 0.0.1-experimental.20250325.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.
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import net from "net";
|
|
2
2
|
async function isPortAvailable(port) {
|
|
3
3
|
return new Promise((resolve) => {
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const portTester = net.createConnection(port, "127.0.0.1");
|
|
5
|
+
portTester.setTimeout(1000);
|
|
6
|
+
const cleanup = () => {
|
|
7
|
+
portTester.removeAllListeners();
|
|
8
|
+
portTester.destroy();
|
|
9
|
+
};
|
|
10
|
+
portTester.once("error", (err) => {
|
|
11
|
+
cleanup();
|
|
6
12
|
if (err.code === "ECONNREFUSED") {
|
|
7
13
|
resolve(true);
|
|
8
14
|
}
|
|
@@ -10,8 +16,12 @@ async function isPortAvailable(port) {
|
|
|
10
16
|
resolve(false);
|
|
11
17
|
}
|
|
12
18
|
});
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
portTester.once("connect", () => {
|
|
20
|
+
cleanup();
|
|
21
|
+
resolve(false);
|
|
22
|
+
});
|
|
23
|
+
portTester.once("timeout", () => {
|
|
24
|
+
cleanup();
|
|
15
25
|
resolve(false);
|
|
16
26
|
});
|
|
17
27
|
});
|