Commit 4f2f800
repl: fix FileHandle leak in history initialization
Ensure that the history file handle is closed if initialization fails or
flushing throws an error. This prevents ERR_INVALID_STATE errors where
a FileHandle object is closed during garbage collection.
PR-URL: #61706
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Anna Henningsen <anna@addaleax.net>1 parent 221648a commit 4f2f800Copy full SHA for 4f2f800
2 files changed
+57Lines changed: 57 additions & 0 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- lib/internal/repl
- test/parallel
Expand file treeCollapse file tree
Open diff view settings
Collapse file
lib/internal/repl/history.js
Copy file name to clipboardExpand all lines: lib/internal/repl/history.js+1Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
327 | 327 | |
328 | 328 | |
329 | 329 | |
| 330 | + |
330 | 331 | |
331 | 332 | |
332 | 333 | |
|
Collapse file
test/parallel/test-repl-history-init-fail-leak.js
Copy file name to clipboard+56Lines changed: 56 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
0 commit comments