systeminformation 5.24.4 → 5.24.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/users.js +11 -3
  2. package/package.json +1 -1
package/lib/users.js CHANGED
@@ -105,10 +105,18 @@ function parseUsersDarwin(lines) {
105
105
 
106
106
  // who part
107
107
  if (is_whopart) {
108
+ let dt = ('' + new Date().getFullYear()) + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2);
109
+ try {
110
+ if (new Date(dt) > new Date) {
111
+ dt = ('' + (new Date().getFullYear() - 1)) + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2);
112
+ }
113
+ } catch {
114
+ util.noop();
115
+ }
108
116
  result_who.push({
109
117
  user: l[0],
110
118
  tty: l[1],
111
- date: ('' + new Date().getFullYear()) + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2),
119
+ date: dt,
112
120
  time: l[4],
113
121
  });
114
122
  } else {
@@ -146,7 +154,7 @@ function users(callback) {
146
154
 
147
155
  // linux
148
156
  if (_linux) {
149
- exec('who --ips; echo "---"; w | tail -n +2', function (error, stdout) {
157
+ exec('export LC_ALL=C; who --ips; echo "---"; w; unset LC_ALL | tail -n +2', function (error, stdout) {
150
158
  if (!error) {
151
159
  // lines / split
152
160
  let lines = stdout.toString().split('\n');
@@ -195,7 +203,7 @@ function users(callback) {
195
203
  }
196
204
 
197
205
  if (_darwin) {
198
- exec('who; echo "---"; w -ih', function (error, stdout) {
206
+ exec('export LC_ALL=C; who; echo "---"; w -ih; unset LC_ALL', function (error, stdout) {
199
207
  if (!error) {
200
208
  // lines / split
201
209
  let lines = stdout.toString().split('\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.24.4",
3
+ "version": "5.24.5",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",