Skip to content

Commit 3b8d394

Browse files
author
codemodify
committed
fix the mac service
1 parent 47063eb commit 3b8d394

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

Service/system-service_darwin.go

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -293,33 +293,35 @@ func (thisRef MacOSService) FilePath() string {
293293

294294
// FileContent -
295295
func (thisRef MacOSService) FileContent() ([]byte, error) {
296-
plistTemplate := template.Must(template.New("launchdConfig").Parse(
297-
`<?xml version='1.0' encoding='UTF-8'?>
298-
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\" >
299-
<plist version='1.0'>
300-
<dict>
301-
<key>Label</key>
302-
<string>{{ .DisplayLabel }}</string>
303-
304-
<key>ProgramArguments</key>
305-
<array>{{ range $arg := .Args }}
306-
<string>{{ $arg }}</string>{{ end }}
307-
</array>
308-
309-
<key>StandardOutPath</key>
310-
<string>{{ .StdOutPath }}</string>
311-
312-
<key>StandardErrorPath</key>
313-
<string>{{ .StdErrPath }}</string>
314-
315-
<key>KeepAlive</key> <{{ .KeepAlive }}/>
316-
<key>RunAtLoad</key> <{{ .RunAtLoad }}/>
317-
318-
<key>WorkingDirectory</key>
319-
<string>{{ .WorkingDirectory }}</string>
320-
</dict>
321-
</plist>
322-
`))
296+
plistTemplate := template.Must(template.New("launchdConfig").Parse(`
297+
<?xml version='1.0' encoding='UTF-8'?>
298+
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\" >
299+
<plist version='1.0'>
300+
<dict>
301+
<key>Label</key>
302+
<string>{{ .Name }}</string>
303+
304+
<key>ProgramArguments</key>
305+
<array>{{ range $arg := .Args }}
306+
<string>{{ $arg }}</string>{{ end }}
307+
</array>
308+
309+
<key>StandardOutPath</key>
310+
<string>{{ .StdOutPath }}</string>
311+
312+
<key>StandardErrorPath</key>
313+
<string>{{ .StdErrPath }}</string>
314+
315+
<key>KeepAlive</key>
316+
<{{ .KeepAlive }}/>
317+
<key>RunAtLoad</key>
318+
<{{ .RunAtLoad }}/>
319+
320+
<key>WorkingDirectory</key>
321+
<string>{{ .WorkingDirectory }}</string>
322+
</dict>
323+
</plist>
324+
`))
323325

324326
var plistTemplateBytes bytes.Buffer
325327
if err := plistTemplate.Execute(&plistTemplateBytes, thisRef.command); err != nil {

0 commit comments

Comments
 (0)