1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-17 16:53:13 +00:00

Updated to only use fs.Watch if it exists

This commit is contained in:
Bryan Roe
2019-03-14 15:41:10 -07:00
parent fd7252d7d5
commit 0048acf128
2 changed files with 14 additions and 11 deletions

File diff suppressed because one or more lines are too long

View File

@@ -346,12 +346,15 @@ function UserSessions()
else if(process.platform == 'linux') else if(process.platform == 'linux')
{ {
var dbus = require('linux-dbus'); var dbus = require('linux-dbus');
this._linuxWatcher = require('fs').watch('/var/run/utmp'); if (require('fs').watch)
this._linuxWatcher.user_session = this;
this._linuxWatcher.on('change', function (a, b)
{ {
this.user_session.emit('changed'); this._linuxWatcher = require('fs').watch('/var/run/utmp');
}); this._linuxWatcher.user_session = this;
this._linuxWatcher.on('change', function (a, b)
{
this.user_session.emit('changed');
});
}
this._users = function _users() this._users = function _users()
{ {
var child = require('child_process').execFile('/bin/sh', ['sh']); var child = require('child_process').execFile('/bin/sh', ['sh']);