11const os = require ( "node:os" ) ;
2+ const { execFileSync } = require ( "node:child_process" ) ;
23const si = require ( "systeminformation" ) ;
34// needed with relative path because logSystemInformation is called in an own process in app.js:
45const mmVersion = require ( "../package" ) . version ;
56const 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+
717const 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