Skip to content

Commit 2dbd8c8

Browse files
authored
Allow PIDUSAGE_USE_PS to have string type of "true" (#141)
1 parent 766b657 commit 2dbd8c8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function pidusage (pids, options, callback) {
2222
}
2323

2424
options = Object.assign({
25-
usePs: process.env.PIDUSAGE_USE_PS,
25+
usePs: /^true$/i.test(process.env.PIDUSAGE_USE_PS),
2626
maxage: process.env.PIDUSAGE_MAXAGE
2727
}, options)
2828

test/ps.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ test('should be able to set usePs from env var', async t => {
158158
let usePsFromStats
159159

160160
mockery.registerMock('./lib/stats', (_, options) => {
161-
usePsFromStats = !!options.usePs
161+
usePsFromStats = options.usePs
162162
})
163163

164164
const beforeValue = process.env.PIDUSAGE_USE_PS
165-
process.env.PIDUSAGE_USE_PS = '1'
165+
process.env.PIDUSAGE_USE_PS = 'true'
166166

167167
const pidusage = require('../')
168168
pidusage(1, () => {})

0 commit comments

Comments
 (0)