Commit 04fe79a
committed
fs: validate the callback passed to fs.rm()
Every other callback based fs API runs its callback through
makeCallback(), so a missing or non-function callback is reported
synchronously as ERR_INVALID_ARG_TYPE. fs.rm() skipped that step, so
the bad callback was not noticed until rimraf tried to invoke it, by
which point the removal had already happened and the resulting
"callback is not a function" TypeError was thrown from an async
completion handler where it could not be caught.
Refs: #65578
Signed-off-by: Paul Bouchon <mail@bitpshr.net>1 parent 29c517f commit 04fe79a
2 files changed
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1534 | 1534 | | |
1535 | 1535 | | |
1536 | 1536 | | |
| 1537 | + | |
1537 | 1538 | | |
1538 | 1539 | | |
1539 | 1540 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
488 | 511 | | |
489 | 512 | | |
490 | 513 | | |
| |||
0 commit comments