github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/install/stop_darwin.go (about)

     1  // Copyright 2019 Keybase, Inc. All rights reserved. Use of
     2  // this source code is governed by the included BSD license.
     3  
     4  //go:build darwin
     5  // +build darwin
     6  
     7  package install
     8  
     9  import (
    10  	"github.com/keybase/client/go/launchd"
    11  	"github.com/keybase/client/go/libkb"
    12  	keybase1 "github.com/keybase/client/go/protocol/keybase1"
    13  )
    14  
    15  func StopAllButService(mctx libkb.MetaContext, _ keybase1.ExitCode) {
    16  	g := mctx.G()
    17  	mctx.Debug("+ StopAllButService")
    18  	if libkb.IsBrewBuild {
    19  		if _, err := launchd.Stop(DefaultServiceLabel(g.Env.GetRunMode()), defaultLaunchdWait, g.Log); err != nil {
    20  			mctx.Debug(err.Error())
    21  		}
    22  	}
    23  	mctx.Debug("StopAllButService: Terminating app")
    24  	err := TerminateApp(g, g.Log)
    25  	if err != nil {
    26  		mctx.Debug(err.Error())
    27  	}
    28  	mctx.Debug("StopAllButService: Terminating KBFS")
    29  	err = UninstallKBFSOnStop(g, g.Log)
    30  	if err != nil {
    31  		mctx.Debug(err.Error())
    32  	}
    33  	mctx.Debug("StopAllButService: Terminating updater")
    34  	err = UninstallUpdaterService(g, g.Log)
    35  	if err != nil {
    36  		mctx.Debug(err.Error())
    37  	}
    38  	mctx.Debug("StopAllButService: Terminating Keybase services")
    39  	err = UninstallKeybaseServices(g, g.Log)
    40  	if err != nil {
    41  		mctx.Debug(err.Error())
    42  	}
    43  	mctx.Debug("- StopAllButService")
    44  }