mirror of
https://github.com/luxfi/vm.git
synced 2026-10-30 15:13:40 +00:00
- Fix dag package imports to use vm/proto/pb/dag instead of node/proto - Fix api/health test to use atomic.Atomic from github.com/luxfi/atomic - Fix components/message test to use crypto.RandomBytes - Fix chains/manager to use correct EngineType constant
33 lines
544 B
Go
33 lines
544 B
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package subprocess
|
|
|
|
import (
|
|
"context"
|
|
"os/exec"
|
|
"sync"
|
|
|
|
"github.com/luxfi/log"
|
|
"github.com/luxfi/vm/rpc/runtime"
|
|
)
|
|
|
|
func NewStopper(logger log.Logger, cmd *exec.Cmd) runtime.Stopper {
|
|
return &stopper{
|
|
cmd: cmd,
|
|
logger: logger,
|
|
}
|
|
}
|
|
|
|
type stopper struct {
|
|
once sync.Once
|
|
cmd *exec.Cmd
|
|
logger log.Logger
|
|
}
|
|
|
|
func (s *stopper) Stop(ctx context.Context) {
|
|
s.once.Do(func() {
|
|
stop(ctx, s.logger, s.cmd)
|
|
})
|
|
}
|