@leynier/ccst 0.5.1 → 0.5.2
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/commands/ccs/start.ts +38 -22
package/package.json
CHANGED
|
@@ -44,29 +44,45 @@ export const ccsStartCommand = async (
|
|
|
44
44
|
ensureDaemonDir();
|
|
45
45
|
const logPath = getLogPath();
|
|
46
46
|
const ccsPath = getCcsExecutable();
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
47
|
+
let pid: number | undefined;
|
|
48
|
+
if (process.platform === "win32") {
|
|
49
|
+
// On Windows, use PowerShell with Start-Process -WindowStyle Hidden
|
|
50
|
+
// This is the only way to completely hide a console app that creates its own window
|
|
51
|
+
const ps = spawn(
|
|
52
|
+
"powershell",
|
|
53
|
+
[
|
|
54
|
+
"-WindowStyle",
|
|
55
|
+
"Hidden",
|
|
56
|
+
"-Command",
|
|
57
|
+
`$p = Start-Process -FilePath '${ccsPath}' -ArgumentList 'config' -WindowStyle Hidden -PassThru; $p.Id`,
|
|
58
|
+
],
|
|
59
|
+
{
|
|
60
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
61
|
+
windowsHide: true,
|
|
62
|
+
},
|
|
63
|
+
);
|
|
64
|
+
const output = await new Response(ps.stdout).text();
|
|
65
|
+
pid = Number.parseInt(output.trim(), 10);
|
|
66
|
+
if (!Number.isFinite(pid)) {
|
|
67
|
+
console.log(pc.red("Failed to start CCS config daemon"));
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
// On Unix, use regular spawn with detached mode
|
|
72
|
+
const logFd = openSync(logPath, "a");
|
|
73
|
+
const child = spawn(ccsPath, ["config"], {
|
|
74
|
+
detached: true,
|
|
75
|
+
stdio: ["ignore", logFd, logFd],
|
|
76
|
+
});
|
|
77
|
+
if (!child.pid) {
|
|
78
|
+
console.log(pc.red("Failed to start CCS config daemon"));
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
pid = child.pid;
|
|
82
|
+
child.unref();
|
|
65
83
|
}
|
|
66
|
-
await writePid(
|
|
67
|
-
|
|
68
|
-
child.unref();
|
|
69
|
-
console.log(pc.green(`CCS config daemon started (PID: ${child.pid})`));
|
|
84
|
+
await writePid(pid);
|
|
85
|
+
console.log(pc.green(`CCS config daemon started (PID: ${pid})`));
|
|
70
86
|
console.log(pc.dim(`Logs: ${logPath}`));
|
|
71
87
|
console.log(pc.dim("Run 'ccst ccs status' to check status"));
|
|
72
88
|
console.log(pc.dim("Run 'ccst ccs logs' to view logs"));
|