Updates
This commit is contained in:
+7
-5
@@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user