Open port-fkill in ScriptKit
// Name: Port fkill
// Description: Enter port number to kill process listening on port.
// Author: Jesse Goodenough
// GitHub: @JGoodenough
import '@johnlindquist/kit';
const fkill = await npm('fkill');
const outputDivClass =
'flex items-center justify-center text-white font-lg font-semibold h-screen';
try {
const port = await arg('Enter port to kill');
fkill(`:${port}`, { force: true });
await div(
`Process ${pid} listening on port ${port} has been killed.`,
outputDivClass
);
} catch (err) {
console.error(err);
await div(
`An error occurred while attempting to kill the process listening on port: ${port}.`,
outputDivClass
);
}