| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 931118c commit 6f14b3a
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,6 @@ var fs = require('fs'); | |||
| 5 | 5 | var assert = require('assert'); | |
| 6 | 6 | var os = require('os'); | |
| 7 | 7 | var child_process = require('child_process'); | |
| 8 | - var util = require('util'); | ||
| 9 | 8 | ||
| 10 | 9 | ||
| 11 | 10 | exports.testDir = path.dirname(__filename); | |
@@ -405,15 +404,9 @@ exports.getServiceName = function getServiceName(port, protocol) { | |||
| 405 | 404 | var serviceName = port.toString(); | |
| 406 | 405 | ||
| 407 | 406 | try { | |
| 408 | - /* | ||
| 409 | - * I'm not a big fan of readFileSync, but reading /etc/services | ||
| 410 | - * asynchronously here would require implementing a simple line parser, | ||
| 411 | - * which seems overkill for a simple utility function that is not running | ||
| 412 | - * concurrently with any other one. | ||
| 413 | - */ | ||
| 414 | 407 | var servicesContent = fs.readFileSync(etcServicesFileName, | |
| 415 | 408 | { encoding: 'utf8'}); | |
| 416 | - var regexp = util.format('^(\\w+)\\s+\\s%d/%s\\s', port, protocol); | ||
| 409 | + var regexp = `^(\\w+)\\s+\\s${port}/${protocol}\\s`; | ||
| 417 | 410 | var re = new RegExp(regexp, 'm'); | |
| 418 | 411 | ||
| 419 | 412 | var matches = re.exec(servicesContent); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments