Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Blame · ci/agent/disk_windows.go

Line attribution on main · 21 line(s)

215f8aeb
Keenan Nemetz
2d ago
1 //go:build windows
2
3 package agent
4
5 import "golang.org/x/sys/windows"
6
7 // freeBytes reports how many bytes are available to this user on the volume
8 // holding dir. freeBytesAvailableToCaller is GetDiskFreeSpaceEx's first answer and
9 // the one that respects a quota on the account, which is the bound the runner is
10 // trying to respect.
11 func freeBytes(dir string) (int64, error) {
12 p, err := windows.UTF16PtrFromString(dir)
13 if err != nil {
14 return 0, err
15 }
16 var available, total, free uint64
17 if err := windows.GetDiskFreeSpaceEx(p, &available, &total, &free); err != nil {
18 return 0, err
19 }
20 return int64(available), nil
21 }