@ctrl-spc/cli 1.1.7 → 1.1.8

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.
Files changed (2) hide show
  1. package/dist/launchd.js +8 -1
  2. package/package.json +1 -1
package/dist/launchd.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { execFileSync } from 'node:child_process';
2
2
  import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
3
3
  import { homedir } from 'node:os';
4
- import { join } from 'node:path';
4
+ import { basename, join } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { ensureStateDir, getStatePaths } from './session.js';
7
7
  export const PLIST_LABEL = 'com.ctrl-spc.daemon';
@@ -32,6 +32,7 @@ export function buildDaemonPath(home = homedir(), envPath = process.env.PATH ??
32
32
  }
33
33
  export function buildPlist(nodePath, scriptPath, home = homedir(), daemonPath = buildDaemonPath(home)) {
34
34
  const { daemonLogPath } = getStatePaths(home);
35
+ const user = process.env.USER || process.env.LOGNAME || basename(home);
35
36
  return `<?xml version="1.0" encoding="UTF-8"?>
36
37
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
37
38
  <plist version="1.0">
@@ -50,8 +51,14 @@ export function buildPlist(nodePath, scriptPath, home = homedir(), daemonPath =
50
51
  <true/>
51
52
  <key>EnvironmentVariables</key>
52
53
  <dict>
54
+ <key>HOME</key>
55
+ <string>${escapeXml(home)}</string>
56
+ <key>LOGNAME</key>
57
+ <string>${escapeXml(user)}</string>
53
58
  <key>PATH</key>
54
59
  <string>${escapeXml(daemonPath)}</string>
60
+ <key>USER</key>
61
+ <string>${escapeXml(user)}</string>
55
62
  </dict>
56
63
  <key>StandardErrorPath</key>
57
64
  <string>${escapeXml(daemonLogPath)}</string>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctrl-spc/cli",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "Control Space CLI - machine setup and background daemon",
5
5
  "type": "module",
6
6
  "files": [