denoland / node_shims

npm packages providing shims for the Deno namespace and other globals. Useful for running Deno-first programs on Node.
MIT License
149 stars 29 forks source link

feat: addSignalListener, removeSignalListener #145

Closed denizdogan closed 1 year ago

denizdogan commented 1 year ago

I need some input on this idea.

Since Node.js and Deno have different signal types, I modified the declaration of Deno.Signal to be, essentially, Deno.Signal & NodeJS.Signals, preventing us from translating "Deno-only signals" to Node.js.

I tried finding out exactly which signals that mismatch, but I think that might depend on the platform/arch you built the binary on, not sure. On my machine, SIGEMT is the only Deno signal that does not exist in Node.js. SIGIOT, SIGPOLL, SIGUNUSED, SIGXFSZ, and SIGLOST exist in Node.js, but not in Deno.

Additionally, in Node.js, process.addListener returns the NodeJS.Process object itself, whereas in Deno, Deno.addSignalListener returns void, so I figured it would only make sense for the translated Node.js code returns void as well.

Closes https://github.com/denoland/node_shims/issues/129

denizdogan commented 1 year ago

Just so this gets linked to the related issue, this would fix #129