@@ -39,7 +39,7 @@ func getLaunchdAgentPath() *paths.Path {
3939func InstallPlistFile () {
4040 launchdAgentPath := getLaunchdAgentPath ()
4141 if ! launchdAgentPath .Exist () {
42- writeLoadExit (launchdAgentPath )
42+ writeLoadExit (launchdAgentPath , true )
4343 } else {
4444 // we already have an existing launchd plist file, so we check if it's updated
4545 launchAgentContent , _ := launchdAgentPath .ReadFile ()
@@ -49,14 +49,14 @@ func InstallPlistFile() {
4949 } else {
5050 log .Infof ("the autostart file %s needs to be updated" , launchdAgentPath )
5151 removePlistFile ()
52- writeLoadExit (launchdAgentPath )
52+ writeLoadExit (launchdAgentPath , false )
5353 }
5454
5555 }
5656}
5757
58- // writeLoadExit function will write the plist file, load it, and then exit, because launchd will start a new instance.
59- func writeLoadExit (launchdAgentPath * paths.Path ) {
58+ // writeLoadExit function will write the plist file, load it, and then exit (if the exit argument is true) , because launchd will start a new instance.
59+ func writeLoadExit (launchdAgentPath * paths.Path , exit bool ) {
6060 err := writePlistFile (launchdAgentPath )
6161 if err != nil {
6262 log .Error (err )
@@ -65,8 +65,10 @@ func writeLoadExit(launchdAgentPath *paths.Path) {
6565 if err != nil {
6666 log .Error (err )
6767 } else {
68- log .Info ("Quitting, another instance of the agent has been started by launchd" )
69- os .Exit (0 )
68+ if exit {
69+ log .Info ("Quitting, another instance of the agent has been started by launchd" )
70+ os .Exit (0 )
71+ }
7072 }
7173 }
7274}
0 commit comments