/internal/storage/dolt: fix windows build issue
This commit is contained in:
32
internal/storage/dolt/process_unix.go
Normal file
32
internal/storage/dolt/process_unix.go
Normal file
@@ -0,0 +1,32 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package dolt
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func processMayBeAlive(p *os.Process) bool {
|
||||
// Signal 0 checks for existence without sending a real signal.
|
||||
if err := p.Signal(syscall.Signal(0)); err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func terminateProcess(p *os.Process) error {
|
||||
if p == nil {
|
||||
return nil
|
||||
}
|
||||
if err := p.Signal(syscall.SIGTERM); err != nil {
|
||||
// Process may already be dead; treat as success.
|
||||
if strings.Contains(err.Error(), "process already finished") {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user