This commit is contained in:
Benjamin Toby
2025-01-13 09:00:21 +01:00
parent 6364f6a312
commit e0a030f10d
859 changed files with 5397 additions and 10163 deletions
@@ -1,13 +1,15 @@
// @ts-check
const { execSync } = require("child_process");
import { execSync } from "child_process";
/**
*
* @param {number | string | null | undefined} port
* @returns
*/
module.exports = async function killProcessOnPort(port) {
export default async function killProcessOnPort(
port: number | string | null | undefined
) {
if (!port) {
console.error("Error: No port specified");
return;
@@ -41,7 +43,7 @@ module.exports = async function killProcessOnPort(port) {
)
.toString()
.trim();
} catch (/** @type {any} */ error) {
} catch (/** @type {any} */ error: any) {
console.log(
`Error finding PID on ${process.platform}:`,
error.message
@@ -62,7 +64,7 @@ module.exports = async function killProcessOnPort(port) {
execSync(`kill -9 ${processId}`);
}
console.log(`Killed process ${processId} on port ${targetPort}`);
} catch (/** @type {any} */ error) {
} catch (/** @type {any} */ error: any) {
console.error("Error:", error.message);
}
};
}