MCPcopy
hub / github.com/garrytan/gstack / safeUnlink

Function safeUnlink

browse/src/error-handling.ts:15–21  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

13
14/** Remove a file, ignoring ENOENT (already gone). Rethrows other errors. */
15export function safeUnlink(filePath: string): void {
16 try {
17 fs.unlinkSync(filePath);
18 } catch (err: any) {
19 if (err?.code !== 'ENOENT') throw err;
20 }
21}
22
23/** Remove a file, ignoring ALL errors. Use only in best-effort cleanup (shutdown, emergency). */
24export function safeUnlinkQuiet(filePath: string): void {

Callers 10

clearAgentRecordFunction · 0.90
writeClaudeAvailableFunction · 0.90
handleTabStateFunction · 0.90
handleTabSwitchFunction · 0.90
cleanupFunction · 0.90
cleanupLegacyStateFunction · 0.90
startServerFunction · 0.90
acquireServerLockFunction · 0.90
startFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected