Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
djasselette-evs committed Jul 18, 2023
1 parent 13bd91d commit ea36173
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = function (port, method = 'tcp') {
// The regex here will match only the local port column of the output
const lineWithLocalPortRegEx = new RegExp(`^ *${method.toUpperCase()} *[^ ]*:${port}`, 'gm')
const linesWithLocalPort = lines.filter(line => line.match(lineWithLocalPortRegEx))
if (!linesWithLocalPort.length) return Promise.reject(new Error('No process running on port'))

const pids = linesWithLocalPort.reduce((acc, line) => {
const match = line.match(/(\d*)\w*(\n|$)/gm)
Expand Down

0 comments on commit ea36173

Please sign in to comment.