Skip to content

Commit d203fef

Browse files
feat(systeminfo): include Git hash and branch in system information log (#4167)
I suggest to add the commit hash and branch to the system information. This should help trouble shooting issues from developers. Like in #4165. ### before ``` #### System Information #### - SYSTEM: manufacturer: Micro-Star International Co., Ltd.; model: MS-7D75; virtual: false; MM: v2.37.0-develop - OS: ... ... ``` ### after ``` #### System Information #### - MM: version: v2.37.0-develop; git: 03e4eef; branch: develop - SYSTEM: manufacturer: Micro-Star International Co., Ltd.; model: MS-7D75; virtual: false - OS: ... ... ```
1 parent 03e4eef commit d203fef

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/automated-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
timeout-minutes: 30
4040
strategy:
4141
matrix:
42-
node-version: [22.x, 24.x, 26.0.0]
42+
node-version: [22.x, 24.15.0, 26.0.0]
4343
steps:
4444
- name: Install electron dependencies and labwc
4545
run: |

js/systeminformation.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
const os = require("node:os");
2+
const { execFileSync } = require("node:child_process");
23
const si = require("systeminformation");
34
// needed with relative path because logSystemInformation is called in an own process in app.js:
45
const mmVersion = require("../package").version;
56
const Log = require("./logger");
67

8+
let mmGitHash = "";
9+
let mmGitBranch = "";
10+
try {
11+
mmGitHash = execFileSync("git", ["rev-parse", "--short", "HEAD"], { encoding: "utf8" }).trim();
12+
mmGitBranch = execFileSync("git", ["rev-parse", "--abbrev-ref", "HEAD"], { encoding: "utf8" }).trim();
13+
} catch {
14+
// not a git repo or git not available
15+
}
16+
717
const logSystemInformation = async () => {
818
try {
919
const system = await si.system();
@@ -17,7 +27,8 @@ const logSystemInformation = async () => {
1727

1828
let systemDataString = [
1929
"\n#### System Information ####",
20-
`- SYSTEM: manufacturer: ${system.manufacturer}; model: ${system.model}; virtual: ${system.virtual}; MM: v${mmVersion}`,
30+
`- MM: version: v${mmVersion}${mmGitHash ? `; git: ${mmGitHash}` : ""}${mmGitBranch ? `; branch: ${mmGitBranch}` : ""}`,
31+
`- SYSTEM: manufacturer: ${system.manufacturer}; model: ${system.model}; virtual: ${system.virtual}`,
2132
`- OS: platform: ${osInfo.platform}; distro: ${osInfo.distro}; release: ${osInfo.release}; arch: ${osInfo.arch}; kernel: ${versions.kernel}`,
2233
`- VERSIONS: electron: ${process.env.ELECTRON_VERSION}; used node: ${process.env.USED_NODE_VERSION}; installed node: ${installedNodeVersion}; npm: ${versions.npm}; pm2: ${versions.pm2}`,
2334
`- ENV: XDG_SESSION_TYPE: ${process.env.XDG_SESSION_TYPE}; MM_CONFIG_FILE: ${process.env.MM_CONFIG_FILE}`,

0 commit comments

Comments
 (0)