Skip to content

Commit c58b720

Browse files
committed
gopsutil v4, add windows drive seperator clarification
1 parent 369852c commit c58b720

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

agent/ls.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"runtime"
1010
"strings"
1111

12-
"github.com/shirou/gopsutil/v3/disk"
12+
"github.com/shirou/gopsutil/v4/disk"
1313
"golang.org/x/xerrors"
1414

1515
"github.com/coder/coder/v2/coderd/httpapi"
@@ -118,6 +118,8 @@ func listDrives() (LSResponse, error) {
118118
}
119119
contents := make([]LSFile, 0, len(partitionStats))
120120
for _, a := range partitionStats {
121+
// Drive letters on Windows have a trailing separator as part of their name.
122+
// i.e. `os.Open("C:")` does not work, but `os.Open("C:\\")` does.
121123
name := a.Mountpoint + string(os.PathSeparator)
122124
contents = append(contents, LSFile{
123125
Name: name,
@@ -137,7 +139,8 @@ func pathToArray(path string) []string {
137139
out := strings.FieldsFunc(path, func(r rune) bool {
138140
return r == os.PathSeparator
139141
})
140-
// Drive letters on Windows should have a trailing separator.
142+
// Drive letters on Windows have a trailing separator as part of their name.
143+
// i.e. `os.Open("C:")` does not work, but `os.Open("C:\\")` does.
141144
if runtime.GOOS == "windows" && len(out) > 0 {
142145
out[0] += string(os.PathSeparator)
143146
}

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ require (
164164
github.com/prometheus/common v0.62.0
165165
github.com/quasilyte/go-ruleguard/dsl v0.3.21
166166
github.com/robfig/cron/v3 v3.0.1
167-
github.com/shirou/gopsutil/v3 v3.24.4
167+
github.com/shirou/gopsutil/v4 v4.25.2
168168
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
169169
github.com/spf13/afero v1.12.0
170170
github.com/spf13/pflag v1.0.5
@@ -286,7 +286,7 @@ require (
286286
github.com/dop251/goja v0.0.0-20241024094426-79f3a7efcdbd // indirect
287287
github.com/dustin/go-humanize v1.0.1
288288
github.com/eapache/queue/v2 v2.0.0-20230407133247-75960ed334e4 // indirect
289-
github.com/ebitengine/purego v0.6.0-alpha.5 // indirect
289+
github.com/ebitengine/purego v0.8.2 // indirect
290290
github.com/elastic/go-windows v1.0.0 // indirect
291291
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
292292
github.com/felixge/httpsnoop v1.0.4 // indirect
@@ -402,6 +402,7 @@ require (
402402
github.com/ryanuber/go-glob v1.0.0 // indirect
403403
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect
404404
github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect
405+
github.com/shirou/gopsutil/v3 v3.24.4 // indirect
405406
github.com/shoenig/go-m1cpu v0.1.6 // indirect
406407
github.com/sirupsen/logrus v1.9.3 // indirect
407408
github.com/spaolacci/murmur3 v1.1.0 // indirect

go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp
301301
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
302302
github.com/eapache/queue/v2 v2.0.0-20230407133247-75960ed334e4 h1:8EXxF+tCLqaVk8AOC29zl2mnhQjwyLxxOTuhUazWRsg=
303303
github.com/eapache/queue/v2 v2.0.0-20230407133247-75960ed334e4/go.mod h1:I5sHm0Y0T1u5YjlyqC5GVArM7aNZRUYtTjmJ8mPJFds=
304-
github.com/ebitengine/purego v0.6.0-alpha.5 h1:EYID3JOAdmQ4SNZYJHu9V6IqOeRQDBYxqKAg9PyoHFY=
305-
github.com/ebitengine/purego v0.6.0-alpha.5/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ=
304+
github.com/ebitengine/purego v0.8.2 h1:jPPGWs2sZ1UgOSgD2bClL0MJIqu58nOmIcBuXr62z1I=
305+
github.com/ebitengine/purego v0.8.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
306306
github.com/elastic/go-sysinfo v1.15.0 h1:54pRFlAYUlVNQ2HbXzLVZlV+fxS7Eax49stzg95M4Xw=
307307
github.com/elastic/go-sysinfo v1.15.0/go.mod h1:jPSuTgXG+dhhh0GKIyI2Cso+w5lPJ5PvVqKlL8LV/Hk=
308308
github.com/elastic/go-windows v1.0.0 h1:qLURgZFkkrYyTTkvYpsZIgf83AUsdIHfvlJaqaZ7aSY=
@@ -825,6 +825,8 @@ github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN
825825
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
826826
github.com/shirou/gopsutil/v3 v3.24.4 h1:dEHgzZXt4LMNm+oYELpzl9YCqV65Yr/6SfrvgRBtXeU=
827827
github.com/shirou/gopsutil/v3 v3.24.4/go.mod h1:lTd2mdiOspcqLgAnr9/nGi71NkeMpWKdmhuxm9GusH8=
828+
github.com/shirou/gopsutil/v4 v4.25.2 h1:NMscG3l2CqtWFS86kj3vP7soOczqrQYIEhO/pMvvQkk=
829+
github.com/shirou/gopsutil/v4 v4.25.2/go.mod h1:34gBYJzyqCDT11b6bMHP0XCvWeU3J61XRT7a2EmCRTA=
828830
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
829831
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
830832
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy