mirror of
https://github.com/openshift/installer.git
synced 2026-02-05 06:46:36 +01:00
This PR improves cross-platform compatibility. It solves two main issues: 1. inconsistent line endings 2. inconsistent path separators Path separators, in installer, needs to target two different environments: 1. the OS where the installer runs 2. the OS where the injected files been used This PR unified path separators used in 2 to be UNIX path separators, while in 1 to be platform-dependant. Ref: https://forum.golangbridge.org/t/filepath-join-or-path-join/13479 Known issues: The spawn processes, including etcd.exe, kube-apiserver.exe, and openshift-installer.exe, will not exit once installation aborted or completed. Users need to manually terminate those processes in task manager.
20 lines
415 B
Go
20 lines
415 B
Go
//go:build windows
|
|
// +build windows
|
|
|
|
package cache
|
|
|
|
import (
|
|
"os"
|
|
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
func flockFile(f *os.File, lock bool) error {
|
|
if lock {
|
|
var overlapped windows.Overlapped
|
|
return windows.LockFileEx(windows.Handle(f.Fd()), windows.LOCKFILE_EXCLUSIVE_LOCK, 0, 1, 0, &overlapped)
|
|
}
|
|
var overlapped windows.Overlapped
|
|
return windows.UnlockFileEx(windows.Handle(f.Fd()), 0, 1, 0, &overlapped)
|
|
}
|