[BUG] Does not handle `undefined` return value from signal-exit's onExit() function

Open
#84 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
electron, javascript, node.js
Domain
tooling

Research direction

Start in index.js around line 254, then review the linked signal-exit source to understand when onExit() can return undefined. Reproduce the Electron-related path and verify that write-file-atomic completes without attempting to call an undefined value.

Written by the indexing model from the issue text.

Description

Bug

According to the documentation of signal-exit the onExit function always returns a function. But according to the actual source code this is not true. The function can return undefined in specific circumstances (I encounter this within Electron) and write-file-atomic fails when trying to call this undefined function.

I guess the function call should be wrapped with a null check.

Dominant language
JavaScript
Stars
256
Forks
51
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from npm/write-file-atomic

All issues in npm/write-file-atomic

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.