INNER CODE UNIT · JavaScript
cleanup
sebastiancarlos/beachpatrol · beachpatrol.js:275
const cleanup = async () => {
if (cleanupDone) return;
cleanupDone = true;
console.log("Cleaning up and shutting down...");
if (usingUnixDomainSocket && fs.existsSync(SOCKET_PATH)) {
fs.unlinkSync(SOCKET_PATH);
console.log(` - Socket file ${SOCKET_PATH} removed`);
}
if (server) {
server.close();
console.log(" - Server closed");
}
await browserContext?.close();
process.exit(0);
};
// Launch browser with specified profile and args
if (incognito) {