Design challenges with Stdin and Signals #14197
Unanswered
jeff-hykin
asked this question in
Q&A
Replies: 1 comment 1 reply
-
The kind of implicit behavior that you describe is not currently possible, and would require the ability to tell Deno to "unref" the stream. The conventional approach is to be explicit — exit your program when it is time to terminate: Deno.exit(); Here's an example of handling
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
"on SIGINT -> do something" can be accomplished with
Deno.addSignalListener("SIGINT", ()=>/*do something*/)
"on Stdin -> do something" however, has been a bit more challenging.
The behavior I'm looking for is a callback that isn't put on the event loop. E.g. if the rest of the program finished => Deno.exit (e.g. don't sit and wait for Stdin).
Is this possible? I've tried a few round-about methods with streams, but haven't found a non-promise based API.
Beta Was this translation helpful? Give feedback.
All reactions