@shetty4l/core 0.1.18 → 0.1.20
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/daemon.ts +19 -3
package/package.json
CHANGED
package/src/daemon.ts
CHANGED
|
@@ -7,7 +7,14 @@
|
|
|
7
7
|
* No console output — returns structured results for the caller to log.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
closeSync,
|
|
12
|
+
existsSync,
|
|
13
|
+
mkdirSync,
|
|
14
|
+
openSync,
|
|
15
|
+
readFileSync,
|
|
16
|
+
unlinkSync,
|
|
17
|
+
} from "fs";
|
|
11
18
|
import { join } from "path";
|
|
12
19
|
import type { Result } from "./result";
|
|
13
20
|
import { err, ok } from "./result";
|
|
@@ -153,12 +160,21 @@ export function createDaemonManager(opts: DaemonManagerOpts): DaemonManager {
|
|
|
153
160
|
mkdirSync(configDir, { recursive: true });
|
|
154
161
|
}
|
|
155
162
|
|
|
163
|
+
// Open log file in append mode so previous content is preserved
|
|
164
|
+
// and ongoing console.error output from the child is captured.
|
|
165
|
+
// Bun.file() opens with O_WRONLY|O_CREAT (no append, no truncate)
|
|
166
|
+
// which writes from offset 0 and corrupts logs.
|
|
167
|
+
const logFd = openSync(logFile, "a");
|
|
168
|
+
|
|
156
169
|
const proc = Bun.spawn(["bun", "run", cliPath, serveCommand], {
|
|
157
|
-
stdout:
|
|
158
|
-
stderr:
|
|
170
|
+
stdout: logFd,
|
|
171
|
+
stderr: logFd,
|
|
159
172
|
stdin: "ignore",
|
|
160
173
|
});
|
|
161
174
|
|
|
175
|
+
// Child inherits its own copy of the fd; parent can close safely.
|
|
176
|
+
closeSync(logFd);
|
|
177
|
+
|
|
162
178
|
writePid(pidFile, proc.pid);
|
|
163
179
|
|
|
164
180
|
if (healthUrl) {
|