fixed file path

This commit is contained in:
MasterGordon 2025-10-23 18:10:31 +02:00
parent 79a5106e76
commit 01a4022b9d
2 changed files with 17 additions and 5 deletions

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bun #!/usr/bin/env bun
import path from "path";
const STATE_FILE = "/tmp/csharpierd-state.json"; const STATE_FILE = "/tmp/csharpierd-state.json";
const LOCK_FILE = "/tmp/csharpierd.lock"; const LOCK_FILE = "/tmp/csharpierd.lock";
const SERVER_PORT = 18912; const SERVER_PORT = 18912;
@ -205,7 +207,7 @@ async function formatCode(
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
body: JSON.stringify({ body: JSON.stringify({
fileName: `/tmp/${fileName}`, fileName: path.join(process.cwd(), fileName),
fileContents, fileContents,
}), }),
}); });
@ -297,7 +299,9 @@ async function showStatus(): Promise<void> {
if (!state) { if (!state) {
console.log(colorize("Status:", "cyan"), colorize("NOT RUNNING", "red")); console.log(colorize("Status:", "cyan"), colorize("NOT RUNNING", "red"));
console.log("\nNo server is currently active."); console.log("\nNo server is currently active.");
console.log("The server will start automatically on the first format request."); console.log(
"The server will start automatically on the first format request.",
);
return; return;
} }
@ -329,9 +333,17 @@ async function showStatus(): Promise<void> {
const timeoutMinutes = IDLE_TIMEOUT_MS / 1000 / 60; const timeoutMinutes = IDLE_TIMEOUT_MS / 1000 / 60;
if (idleMinutes >= timeoutMinutes) { if (idleMinutes >= timeoutMinutes) {
console.log(colorize("Idle Time:", "cyan"), colorize(idleTimeStr, "red"), "(will shutdown)"); console.log(
colorize("Idle Time:", "cyan"),
colorize(idleTimeStr, "red"),
"(will shutdown)",
);
} else if (idleMinutes >= timeoutMinutes * 0.75) { } else if (idleMinutes >= timeoutMinutes * 0.75) {
console.log(colorize("Idle Time:", "cyan"), colorize(idleTimeStr, "yellow"), `(${timeoutMinutes - idleMinutes}m until timeout)`); console.log(
colorize("Idle Time:", "cyan"),
colorize(idleTimeStr, "yellow"),
`(${timeoutMinutes - idleMinutes}m until timeout)`,
);
} else { } else {
console.log(colorize("Idle Time:", "cyan"), colorize(idleTimeStr, "green")); console.log(colorize("Idle Time:", "cyan"), colorize(idleTimeStr, "green"));
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "csharpierd", "name": "csharpierd",
"version": "1.0.0", "version": "1.0.1",
"description": "A persistent CSharpier formatting daemon with automatic server management and idle timeout", "description": "A persistent CSharpier formatting daemon with automatic server management and idle timeout",
"module": "index.ts", "module": "index.ts",
"type": "module", "type": "module",