Skip to content

Commit

Permalink
Allow PIDUSAGE_USE_PS to have string type of "true" (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
basiam authored Oct 25, 2022
1 parent 766b657 commit 2dbd8c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function pidusage (pids, options, callback) {
}

options = Object.assign({
usePs: process.env.PIDUSAGE_USE_PS,
usePs: /^true$/i.test(process.env.PIDUSAGE_USE_PS),
maxage: process.env.PIDUSAGE_MAXAGE
}, options)

Expand Down
4 changes: 2 additions & 2 deletions test/ps.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ test('should be able to set usePs from env var', async t => {
let usePsFromStats

mockery.registerMock('./lib/stats', (_, options) => {
usePsFromStats = !!options.usePs
usePsFromStats = options.usePs
})

const beforeValue = process.env.PIDUSAGE_USE_PS
process.env.PIDUSAGE_USE_PS = '1'
process.env.PIDUSAGE_USE_PS = 'true'

const pidusage = require('../')
pidusage(1, () => {})
Expand Down

0 comments on commit 2dbd8c8

Please sign in to comment.