Open
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected]
for the project I'm working on.
I saw version 4.1.0 to
Add the ability to capture signal exits by returning true from the onExit listener.
and decided to try.
I found that capturing signal by returning true actually works only once — after first capture signal-exit eats it successfully but gets unloaded.
Here is the diff that solved my problem:
diff --git a/node_modules/signal-exit/dist/mjs/index.js b/node_modules/signal-exit/dist/mjs/index.js
index 4a78bad..3a289aa 100644
--- a/node_modules/signal-exit/dist/mjs/index.js
+++ b/node_modules/signal-exit/dist/mjs/index.js
@@ -61,13 +61,14 @@ class Emitter {
if (this.emitted[ev]) {
return false;
}
- this.emitted[ev] = true;
let ret = false;
for (const fn of this.listeners[ev]) {
ret = fn(code, signal) === true || ret;
}
+ this.emitted[ev] = !ret;
if (ev === 'exit') {
ret = this.emit('afterExit', code, signal) || ret;
+ this.emitted['afterExit'] = !ret;
}
return ret;
}
@@ -139,6 +140,7 @@ class SignalExit extends SignalExitBase {
const s = sig === 'SIGHUP' ? this.#hupSig : sig;
if (!ret)
process.kill(process.pid, s);
+ else this.load()
/* c8 ignore stop */
}
};
This issue body was partially generated by patch-package.
Metadata
Assignees
Labels
No labels