Summary
In src/infra/gateway-lock.ts:264-286, when fs.open(lockPath, "wx") succeeds but handle.writeFile() fails (e.g. disk full), the code throws GatewayLockError without closing the file handle, leaking a file descriptor.
Reproduction
Source inspection: the inner writeFile call on line 275 is not wrapped in a try-catch that closes the handle on failure.
Expected
Close the fd and remove the partial lock file before re-throwing.
Scope
src/infra/gateway-lock.ts — 1 file, ~5 LoC change.
Summary
In
src/infra/gateway-lock.ts:264-286, whenfs.open(lockPath, "wx")succeeds buthandle.writeFile()fails (e.g. disk full), the code throwsGatewayLockErrorwithout closing the file handle, leaking a file descriptor.Reproduction
Source inspection: the inner
writeFilecall on line 275 is not wrapped in a try-catch that closes the handle on failure.Expected
Close the fd and remove the partial lock file before re-throwing.
Scope
src/infra/gateway-lock.ts— 1 file, ~5 LoC change.