Skip to content

[bug]: UnhandledPromiseRejectionWarning: Error: Stream closed  #14

@azmizar

Description

@azmizar

Describe the bug
Unhandled promise rejection when STDIN stream is forcibly closed (CTRL-C).

To Reproduce
Steps to reproduce the behavior:

  1. Execute prompter.prompt() or prompter.prompts()
  2. Hit CTRL-C
  3. See error
Select example to run > (node:3625) UnhandledPromiseRejectionWarning: Error: Stream closed
    at PromptImpl._this.onCloseCB (file:///Users/azmizar/Projects/SimplyAppDevs/nodejs/nodejs-prompt-example/node_modules/@simplyappdevs/nodejs-prompt/dist/esm/prompter.js:118:36)
    at Interface.<anonymous> (file:///Users/azmizar/Projects/SimplyAppDevs/nodejs/nodejs-prompt-example/node_modules/@simplyappdevs/nodejs-prompt/dist/esm/prompter.js:70:19)
    at Interface.emit (events.js:327:22)
    at Interface.close (readline.js:424:8)
    at Interface._ttyWrite (readline.js:878:16)
    at ReadStream.onkeypress (readline.js:213:10)
    at ReadStream.emit (events.js:315:20)
    at emitKeys (internal/readline/utils.js:345:14)
    at emitKeys.next (<anonymous>)
    at ReadStream.onData (readline.js:1144:36)
    at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)
    at processPromiseRejections (internal/process/promises.js:247:11)
    at processTicksAndRejections (internal/process/task_queues.js:94:32)

Expected behavior
Exception should have been returned as part of .catch() chain and not as unhandled exception

Screenshots
N/A

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions