Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Replacing path.existsSync with fs.existsSync #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/interfaces.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = (server) ->
content = Fs.readFileSync(procfile, 'ascii').trim()
for line in content.split('\n')[2...]
continue if line.match /lo:/
continue if line.match /veth[a-zA-Z0-9]+:/
regex = /(.+):(.*)/
matched = line.match(regex)
iface = matched[1].trim()
Expand Down
6 changes: 3 additions & 3 deletions scripts/load_avg.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Fs = require 'fs'
Path = require 'path'
Fs = require 'fs'

module.exports = (server) ->
run = () ->
Expand All @@ -8,9 +8,9 @@ module.exports = (server) ->

# Read from /proc
procfile = '/proc/loadavg'
if Path.existsSync procfile
if Fs.existsSync procfile
data = Fs.readFileSync(procfile, 'utf-8')
[one, five, fifteen] = data.split(' ', 3)
server.push_metric "#{metricPrefix}.short", one
server.push_metric "#{metricPrefix}.medium", five
server.push_metric "#{metricPrefix}.long", fifteen
server.push_metric "#{metricPrefix}.long", fifteen
3 changes: 1 addition & 2 deletions src/start.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Server = require './server'
Path = require 'path'
Cli = require('cli').enable('status', 'version')
Fs = require 'fs'

Expand All @@ -12,7 +11,7 @@ module.exports = entry_point = () ->
'config': ['c', 'Configuration file path', 'path', './config.json']

Cli.main (args, options) ->
if Path.existsSync options.config
if Fs.existsSync options.config
try
conf = JSON.parse(Fs.readFileSync(options.config, 'utf-8'))
catch error
Expand Down