From: Chris Duncan Date: Sat, 25 Jul 2026 06:26:46 +0000 (-0700) Subject: Clean up process ID file when server exits. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=9814afd306d662f24b8f48913063088aa34adfea;p=nano-pow.git Clean up process ID file when server exits. --- diff --git a/src/bin/server.ts b/src/bin/server.ts index 081a22f..4b798ae 100755 --- a/src/bin/server.ts +++ b/src/bin/server.ts @@ -6,7 +6,7 @@ import { WorkErrorResponse, WorkGenerateResponse, WorkValidateResponse } from 'n import { Logger, isHex32, isHex8 } from 'nano-pow/utils' import { Serializable } from 'node:child_process' import { hash } from 'node:crypto' -import { readFile, writeFile } from 'node:fs/promises' +import { readFile, rm, writeFile } from 'node:fs/promises' import * as http from 'node:http' import { homedir } from 'node:os' import { join } from 'node:path' @@ -414,6 +414,7 @@ function shutdown (): void { process.exit(1) }, 10_000) server.close(async (): Promise => { + await rm(`${homedir()}/.nano-pow/server.pid`, { force: true }) await browser.close() clearTimeout(kill) logger.log('server stopped')