voicecc 1.1.27 → 1.1.29

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/bin/voicecc.js CHANGED
@@ -24,7 +24,20 @@ const PKG_ROOT = join(__dirname, "..");
24
24
  const TSX_BIN = join(PKG_ROOT, "node_modules", ".bin", "tsx");
25
25
  const ENV_PATH = join(PKG_ROOT, ".env");
26
26
 
27
- const VOICECC_DIR = join(homedir(), ".voicecc");
27
+ // When running as root on Linux, use the voicecc user's home directory so
28
+ // both the CLI (root) and the server process (voicecc user) can access the
29
+ // same status/PID files. /root is typically mode 700, so a non-root user
30
+ // cannot traverse it to reach /root/.voicecc.
31
+ let voiceccDir = join(homedir(), ".voicecc");
32
+ if (process.getuid && process.getuid() === 0 && platform() === "linux") {
33
+ try {
34
+ const voiceccHome = execSync(`eval echo ~voicecc`, { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim();
35
+ if (voiceccHome && !voiceccHome.startsWith("~")) {
36
+ voiceccDir = join(voiceccHome, ".voicecc");
37
+ }
38
+ } catch { /* voicecc user doesn't exist yet, use default */ }
39
+ }
40
+ const VOICECC_DIR = voiceccDir;
28
41
  const PID_FILE = join(VOICECC_DIR, "voicecc.pid");
29
42
  const LOG_FILE = join(VOICECC_DIR, "voicecc.log");
30
43
  const STATUS_FILE = join(VOICECC_DIR, "status.json");