disable process.on('SIGTERM') SIGQUIT SIGINT #246
-
Hello, Would it be possible to include an option to disable the "quit" handlers of ftp-srv? process.on('SIGTERM', quit); I would like my app, using the excellent library, to be able to gracefully close the FTP server IN ADDITION TO closing other connections and processes. With the ftp-srv event listeners in place, my own handlers fail to function. I'm currently circumventing this by commenting out the 3 lines above, but this is not a sustainable solution. Any pointers would be much appreciated. Thanks, Ian |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
This is a great point. From a library perspective it doesn't make a lot of sense to hijack the process and end it like that. class FtpServer extends EventEmitter {
constructor(options = {}) {
super();
this.options = Object.assign({
...,
endProcessSig: true // Better name?
}, options);
...
if (this.options.endProcessSig) {
process.on('SIGTERM', quit);
process.on('SIGINT', quit);
process.on('SIGQUIT', quit);
}
}
} |
Beta Was this translation helpful? Give feedback.
-
Hello Tyler,
Thank you for the prompt and informative response. And compliments on
your excellent library.
I would not want you to include any breaking changes.
And having the current default behaviour of automatically calling
process.exit() is not an entirely bad idea.
But, I'd definitely be in favour of you including the changes you
detailed that extend EventEmitter to check for the state of a newly
provided boolean option.
That looks like a neat and intuitive approach.
Thanks again,
Ian
…------ Original Message ------
From: "Tyler Stewart" <[email protected]>
To: "autovance/ftp-srv" <[email protected]>
Cc: "Ian Watson" <[email protected]>; "Author"
<[email protected]>
Sent: 10/03/2021 17:49:21
Subject: Re: [autovance/ftp-srv] disable process.on('SIGTERM') SIGQUIT
SIGINT (#246)
This is a great point. From a library perspective it doesn't make a lot
of sense to hijack the process and end it like that.
Do you think keeping the SIG- events to call close would make more
sense? Or just remove them completely? Either way would be a breaking
change.
A boolean option could be added to the constructor
<https://github.com/autovance/ftp-srv/blob/master/src/index.js#L13>
that would only call each process.on if true. This wouldn't be breaking
and would satisfy your requirements.
classFtpServerextendsEventEmitter{constructor(options={}){super();this.options=Object.assign({
...,endProcessSig: true// Better name?},options);
...
if(this.options.endProcessSig){process.on('SIGTERM',quit);process.on('SIGINT',quit);process.on('SIGQUIT',quit);}}}
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#246 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AED5EJWQWASWXK5PLSLYT7TTC6BHDANCNFSM4Y5RQJFA>.
|
Beta Was this translation helpful? Give feedback.
-
I've converted this discussion to a feature request here: #280 |
Beta Was this translation helpful? Give feedback.
I've converted this discussion to a feature request here: #280