Files
shadowdaoandClaude Sonnet 5.5 962d708fdd Rename Go module paths to repo.anhonesthost.net/CyberCoveLLC/threshold
Rename root, api and sdk module paths (imports, go.mod, go_package,
ldflags, build scripts, buf configs) and regenerate protobuf/gateway
code with the project's pinned toolchain. Wire identifiers unchanged.
api gets a local replace for sdk; root/api/sdk require v0.1.0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 10:33:41 -07:00

43 lines
1.0 KiB
Go

// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: BUSL-1.1
//go:build !windows
// +build !windows
package cache
import (
"context"
"errors"
"fmt"
"path/filepath"
"syscall"
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/util"
)
// stop will send a term signal to the cache to shut down.
func (c *StopCommand) stop(ctx context.Context) error {
switch {
case util.IsNil(ctx):
return errors.New("Invalid parameter provided to stop: context is missing")
}
dotPath, err := DefaultDotDirectory(ctx)
if err != nil {
return fmt.Errorf("Error when getting default dot directory: %w", err)
}
pidPath := filepath.Join(dotPath, pidFileName)
p, err := pidFileInUse(ctx, pidPath)
if err != nil {
return fmt.Errorf("Error when checking if the cache's pid file is in use: %w", err)
}
if p == nil {
return errors.New("The cache is not running.")
}
if err := p.Signal(syscall.SIGTERM); err != nil {
return fmt.Errorf("Error when sending sigterm to cache process: %w", err)
}
return nil
}