github.com/10XDev/rclone@v1.52.3-0.20200626220027-16af9ab76b2a/vfs/vfstest/write_non_unix.go (about)

     1  // +build !linux,!darwin,!freebsd
     2  
     3  package vfstest
     4  
     5  import (
     6  	"runtime"
     7  	"testing"
     8  
     9  	"golang.org/x/sys/windows"
    10  )
    11  
    12  // TestWriteFileDoubleClose tests double close on write
    13  func TestWriteFileDoubleClose(t *testing.T) {
    14  	t.Skip("not supported on " + runtime.GOOS)
    15  }
    16  
    17  // writeTestDup performs the platform-specific implementation of the dup() syscall
    18  func writeTestDup(oldfd uintptr) (uintptr, error) {
    19  	p, err := windows.GetCurrentProcess()
    20  	if err != nil {
    21  		return 0, err
    22  	}
    23  	var h windows.Handle
    24  	return uintptr(h), windows.DuplicateHandle(p, windows.Handle(oldfd), p, &h, 0, true, windows.DUPLICATE_SAME_ACCESS)
    25  }