@scrylog/cli 0.1.3 → 0.1.4
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/service/manager.ts +4 -2
package/package.json
CHANGED
package/src/service/manager.ts
CHANGED
|
@@ -64,7 +64,7 @@ export function resolveDaemonExec(configPath?: string, daemonPath = whichCommand
|
|
|
64
64
|
export function renderLaunchAgentPlist(configPath?: string): string {
|
|
65
65
|
const args = resolveDaemonExec(configPath);
|
|
66
66
|
const programArguments = args.map((arg) => ` <string>${xmlEscape(arg)}</string>`).join("\n");
|
|
67
|
-
const path =
|
|
67
|
+
const path = resolveServicePath(args);
|
|
68
68
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
69
69
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
70
70
|
<plist version="1.0">
|
|
@@ -91,11 +91,13 @@ ${programArguments}
|
|
|
91
91
|
|
|
92
92
|
export function renderSystemdUserUnit(configPath?: string): string {
|
|
93
93
|
const args = resolveDaemonExec(configPath);
|
|
94
|
+
const path = resolveServicePath(args);
|
|
94
95
|
return `[Unit]
|
|
95
96
|
Description=scrylog daemon
|
|
96
97
|
After=default.target
|
|
97
98
|
|
|
98
99
|
[Service]
|
|
100
|
+
Environment="PATH=${path}"
|
|
99
101
|
ExecStart=${args.map(shellQuote).join(" ")}
|
|
100
102
|
Restart=on-failure
|
|
101
103
|
RestartSec=3
|
|
@@ -248,7 +250,7 @@ function shellQuote(value: string): string {
|
|
|
248
250
|
return `'${value.replace(/'/g, `'"'"'`)}'`;
|
|
249
251
|
}
|
|
250
252
|
|
|
251
|
-
function
|
|
253
|
+
function resolveServicePath(args: string[]): string {
|
|
252
254
|
const commandPath = args[0];
|
|
253
255
|
const candidates = [
|
|
254
256
|
commandPath && isAbsolute(commandPath) ? dirname(commandPath) : undefined,
|