Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/lib/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

import { execSync, spawn } from "node:child_process";
import {
chmodSync,
closeSync,
existsSync,
fchmodSync,
mkdirSync,
openSync,
readFileSync,
Expand Down Expand Up @@ -61,8 +63,9 @@ function warn(msg: string): void {

function ensurePidDir(pidDir: string): void {
if (!existsSync(pidDir)) {
mkdirSync(pidDir, { recursive: true });
mkdirSync(pidDir, { recursive: true, mode: 0o700 });
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
chmodSync(pidDir, 0o700);
}

function readPid(pidDir: string, name: string): number | null {
Expand Down Expand Up @@ -123,7 +126,8 @@ function startService(
// Uses child_process.spawn directly because execa's typed API
// does not accept raw file descriptors for stdio.
const logFile = join(pidDir, `${name}.log`);
const logFd = openSync(logFile, "w");
const logFd = openSync(logFile, "w", 0o600);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
fchmodSync(logFd, 0o600);
const subprocess = spawn(command, args, {
detached: true,
stdio: ["ignore", logFd, logFd],
Expand Down