版博士V2.0程序
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

  1. module.exports = function (query, force) {
  2. var isAttached = false
  3. if (process.stderr.isTTY || force === true) {
  4. isAttached = true
  5. process.on('SIGINFO', onsiginfo)
  6. process.on('SIGUSR1', onsiginfo)
  7. }
  8. return function () {
  9. if (isAttached === true) {
  10. process.removeListener('SIGINFO', onsiginfo)
  11. process.removeListener('SIGUSR1', onsiginfo)
  12. isAttached = false
  13. }
  14. }
  15. function onsiginfo () {
  16. query()
  17. }
  18. }