magalh 1.0.5 → 1.0.7

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 (3) hide show
  1. package/bin/mgl.js +10 -10
  2. package/msh.js +1 -1
  3. package/package.json +1 -1
package/bin/mgl.js CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  "use strict";
4
4
 
5
- const fs = require("node:fs");
6
- const path = require("node:path");
7
- const { spawn, execFileSync } = require("node:child_process");
5
+ const fs = require("fs");
6
+ const path = require("path");
7
+ const { spawn, execFileSync } = require("child_process");
8
8
 
9
9
  const args = process.argv.slice(2);
10
10
  const rootDir = path.resolve(__dirname, "..");
@@ -76,7 +76,7 @@ if (args.includes("--install-service")) {
76
76
  ` Logs : journalctl -u ${SERVICE_NAME} -f`,
77
77
  );
78
78
  } catch (err) {
79
- console.warn(`[magalh] Warning: systemd setup failed: ${err?.message || err}`);
79
+ console.warn("[magalh] Warning: systemd setup failed: " + ((err && err.message) || String(err)));
80
80
  }
81
81
  }
82
82
 
@@ -86,7 +86,7 @@ if (args.includes("--install-service")) {
86
86
  path.join(process.env.SystemRoot || "C:\\Windows", "System32"),
87
87
  fs.constants.W_OK,
88
88
  );
89
- } catch {
89
+ } catch (_e) {
90
90
  console.log(
91
91
  "[magalh] Skipping Windows service setup (not running as Administrator).\n" +
92
92
  " To install manually: run npm install -g magalh as Administrator.",
@@ -95,8 +95,8 @@ if (args.includes("--install-service")) {
95
95
  }
96
96
  const binPath = `"${nodeBin}" "${mglBin}"`;
97
97
  try {
98
- try { execFileSync("sc", ["stop", SERVICE_NAME], { stdio: "pipe" }); } catch { }
99
- try { execFileSync("sc", ["delete", SERVICE_NAME], { stdio: "pipe" }); } catch { }
98
+ try { execFileSync("sc", ["stop", SERVICE_NAME], { stdio: "pipe" }); } catch (_e) { }
99
+ try { execFileSync("sc", ["delete", SERVICE_NAME], { stdio: "pipe" }); } catch (_e) { }
100
100
  execFileSync("sc", [
101
101
  "create", SERVICE_NAME,
102
102
  "binPath=", binPath,
@@ -120,7 +120,7 @@ if (args.includes("--install-service")) {
120
120
  ` Logs : Event Viewer -> Windows Logs -> Application`,
121
121
  );
122
122
  } catch (err) {
123
- console.warn(`[magalh] Warning: Windows service setup failed: ${err?.message || err}`);
123
+ console.warn("[magalh] Warning: Windows service setup failed: " + ((err && err.message) || String(err)));
124
124
  }
125
125
  }
126
126
 
@@ -145,7 +145,7 @@ child.on("exit", (code, signal) => {
145
145
 
146
146
  child.on("error", (err) => {
147
147
  try {
148
- process.stderr.write(`Failed to start msh: ${err?.message || String(err)}\n`);
149
- } catch { }
148
+ process.stderr.write("Failed to start msh: " + ((err && err.message) || String(err)) + "\n");
149
+ } catch (_e) { }
150
150
  process.exit(1);
151
151
  });