You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
453 B
21 lines
453 B
1 month ago
|
module.exports = function (query, force) {
|
||
|
var isAttached = false
|
||
|
if (process.stderr.isTTY || force === true) {
|
||
|
isAttached = true
|
||
|
process.on('SIGINFO', onsiginfo)
|
||
|
process.on('SIGUSR1', onsiginfo)
|
||
|
}
|
||
|
|
||
|
return function () {
|
||
|
if (isAttached === true) {
|
||
|
process.removeListener('SIGINFO', onsiginfo)
|
||
|
process.removeListener('SIGUSR1', onsiginfo)
|
||
|
isAttached = false
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function onsiginfo () {
|
||
|
query()
|
||
|
}
|
||
|
}
|