bm2 1.0.7 → 1.0.9
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.
- package/package.json +1 -1
- package/src/index.ts +12 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bm2",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "A blazing-fast, full-featured process manager built entirely on Bun native APIs. The modern PM2 replacement — zero Node.js dependencies, pure Bun performance.",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"module": "src/index.ts",
|
package/src/index.ts
CHANGED
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
DASHBOARD_PORT,
|
|
27
27
|
METRICS_PORT,
|
|
28
28
|
DAEMON_OUT_LOG_FILE,
|
|
29
|
+
DAEMON_ERR_LOG_FILE,
|
|
29
30
|
} from "./constants";
|
|
30
31
|
import { ensureDirs, formatBytes, formatUptime, colorize, padRight } from "./utils";
|
|
31
32
|
import { DeployManager } from "./deploy";
|
|
@@ -64,10 +65,16 @@ async function startDaemon(): Promise<void> {
|
|
|
64
65
|
|
|
65
66
|
const daemonScript = join(import.meta.dir, "daemon.ts");
|
|
66
67
|
const bunPath = Bun.which("bun") || "bun";
|
|
67
|
-
|
|
68
|
+
|
|
69
|
+
const stdout = Bun.file(DAEMON_OUT_LOG_FILE);
|
|
70
|
+
const stderr = Bun.file(DAEMON_ERR_LOG_FILE);
|
|
71
|
+
|
|
72
|
+
if(!(await stdout.exists())) await Bun.write(stdout, "");
|
|
73
|
+
if(!(await stderr.exists())) await Bun.write(stderr, "");
|
|
74
|
+
|
|
68
75
|
const child = Bun.spawn([bunPath, "run", daemonScript], {
|
|
69
|
-
stdout
|
|
70
|
-
stderr
|
|
76
|
+
stdout,
|
|
77
|
+
stderr,
|
|
71
78
|
stdin: "ignore",
|
|
72
79
|
});
|
|
73
80
|
|
|
@@ -108,7 +115,8 @@ async function sendToDaemon(msg: DaemonMessage): Promise<DaemonResponse> {
|
|
|
108
115
|
|
|
109
116
|
return resJson;
|
|
110
117
|
} catch (e: any) {
|
|
111
|
-
console.log("Results returned "+res?.text())
|
|
118
|
+
console.log("Results returned: " + await res?.text())
|
|
119
|
+
console.log()
|
|
112
120
|
console.log("sendToDaemon#Error:", e, e.stack)
|
|
113
121
|
return { type: "error", error: "Fetch Error", success: false }
|
|
114
122
|
}
|