mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-23 12:15:42 +00:00
31 lines
707 B
Go
31 lines
707 B
Go
//go:build windows
|
|
|
|
package monitoring
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
func replaceDeadManStateFile(from, to string) error {
|
|
fromPath, err := windows.UTF16PtrFromString(from)
|
|
if err != nil {
|
|
return fmt.Errorf("encode dead-man state source path: %w", err)
|
|
}
|
|
toPath, err := windows.UTF16PtrFromString(to)
|
|
if err != nil {
|
|
return fmt.Errorf("encode dead-man state destination path: %w", err)
|
|
}
|
|
if err := windows.MoveFileEx(
|
|
fromPath,
|
|
toPath,
|
|
windows.MOVEFILE_REPLACE_EXISTING|windows.MOVEFILE_WRITE_THROUGH,
|
|
); err != nil {
|
|
return fmt.Errorf("replace dead-man state with write-through: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func syncDeadManStateDirectory(string) error { return nil }
|