File size: 453 Bytes
bc20498
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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()
  }
}