[GH-ISSUE #143] fix(application): cleanup temporaryRoot when capture home directory creation fails #89

Closed
opened 2026-10-15 18:21:00 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @morluto on GitHub (Jul 14, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/143

Description

In prepareProcessCapture (src/application/ProcessCaptureLifecycle.ts), mkdtemp is called before creating the per-capture home directory. If mkdir(home) throws, the created temporaryRoot is never removed.

Impact

A failed capture attempt can leave a leaked temporary directory on disk after each retry.

Reproduction

  1. Invoke capture preparation where home creation fails (permission/path issue).
  2. Confirm the earlier temporaryRoot remains after the thrown error.

Expected behavior

Any successful mkdtemp allocation should be cleaned up on later setup failure.

Files

  • src/application/ProcessCaptureLifecycle.ts (around lines 419-423)
Originally created by @morluto on GitHub (Jul 14, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/143 ## Description In `prepareProcessCapture` (`src/application/ProcessCaptureLifecycle.ts`), `mkdtemp` is called before creating the per-capture `home` directory. If `mkdir(home)` throws, the created `temporaryRoot` is never removed. ## Impact A failed capture attempt can leave a leaked temporary directory on disk after each retry. ## Reproduction 1. Invoke capture preparation where `home` creation fails (permission/path issue). 2. Confirm the earlier `temporaryRoot` remains after the thrown error. ## Expected behavior Any successful `mkdtemp` allocation should be cleaned up on later setup failure. ## Files - `src/application/ProcessCaptureLifecycle.ts` (around lines 419-423)
bsakaguchi 2026-10-15 18:21:00 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#89
No description provided.