Socket
Socket
Sign inDemoInstall

siginfo

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 2.0.0

11

index.js

@@ -1,6 +0,4 @@

var util = require('util')
module.exports = function (query) {
module.exports = function (query, force) {
var isAttached = false
if (process.stderr.isTTY) {
if (process.stderr.isTTY || force === true) {
isAttached = true

@@ -20,7 +18,4 @@ process.on('SIGINFO', onsiginfo)

function onsiginfo () {
var info = query()
process.stderr.write(typeof info === 'string' ? info : util.inspect(info, {
colors: true
}) + '\n')
query()
}
}
{
"name": "siginfo",
"version": "1.0.2",
"version": "2.0.0",
"description": "Utility module to print pretty messages on SIGINFO/SIGUSR1",

@@ -8,3 +8,3 @@ "main": "index.js",

"devDependencies": {
"standard": "^10.0.3"
"standard": "^14.3.4"
},

@@ -11,0 +11,0 @@ "scripts": {

@@ -14,3 +14,3 @@ # `siginfo`

This module wraps both signals, checks if the process is connected to TTY and
writes to `stderr` on each intercepted signal.
lets you do whatever you want.

@@ -24,6 +24,6 @@ ## Usage

siginfo(function () {
return {
console.dir({
version: pkg.version,
uptime: process.uptime()
}
})
})

@@ -35,5 +35,7 @@

### `var removeListener = siginfo(queryFn)`
### `var removeListener = siginfo(queryFn, [force])`
`queryFn` should return a info string or an object.
`queryFn` can be used for whatever you want (logging, sending a UDP message, etc.).
Setting `force = true` will attach the event handlers whether a TTY is present
or not.

@@ -40,0 +42,0 @@ ## Install

@@ -5,6 +5,6 @@ var siginfo = require('.')

var stop = siginfo(function () {
return {
console.dir({
version: pkg.version,
uptime: process.uptime()
}
})
})

@@ -11,0 +11,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc