From 28675264a86041757a81e9248f63161511314341 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Mon, 19 Nov 2018 22:44:26 +0100 Subject: [PATCH] code cleanup --- CHANGELOG.md | 1 + lib/docker.js | 2 +- lib/util.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ceea04..848b3ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,6 +100,7 @@ Other changes | Version | Date | Comment | | -------------- | -------------- | -------- | +| 3.49.1 | 2018-11-19 | code cleanup | | 3.49.0 | 2018-11-19 | added system `uuid()` (os specific), `versions()` added postgresql | | 3.48.4 | 2018-11-18 | windows: garbled output because of codepage | | 3.48.3 | 2018-11-18 | `dockerContainerStats()` fixed issue `cpu_percent` win | diff --git a/lib/docker.js b/lib/docker.js index fa02f04..d00e78f 100644 --- a/lib/docker.js +++ b/lib/docker.js @@ -141,7 +141,7 @@ function docker_calcCPUPercent(cpu_stats, precpu_stats) { let nanoSecNow = util.nanoSeconds(); let cpuPercent = 0.0; if (_docker_last_read > 0) { - let possIntervals = (nanoSecNow - _docker_last_read) // / 100 * os.cpus().length; + let possIntervals = (nanoSecNow - _docker_last_read); // / 100 * os.cpus().length; let intervalsUsed = cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage; if (possIntervals > 0) { cpuPercent = 100.0 * intervalsUsed / possIntervals; diff --git a/lib/util.js b/lib/util.js index b010d90..c8753bf 100644 --- a/lib/util.js +++ b/lib/util.js @@ -222,7 +222,7 @@ function execWin(cmd, opts, callback) { opts = execOptsWin; } let newCmd = 'chcp 65001 > nul && cmd /C ' + cmd + ' && chcp ' + codepage + ' > nul'; - exec(newCmd, execOptsWin, function (error, stdout) { + exec(newCmd, opts, function (error, stdout) { callback(error, stdout); }); }