Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb15d060

Browse files
authored
fix(agent): return listed drives on failure on windows (#17505)
The behavior of the partitions listing function from gopsutil is that itwill return all partitions that didn't fail to be read, but will returnsomething similar to a multierror.Errors are now ignored unless there are no drives returned.
1 parentca38729 commitb15d060

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎agent/ls.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,14 @@ func listFiles(query LSRequest) (LSResponse, error) {
125125
}
126126

127127
funclistDrives() (LSResponse,error) {
128+
// disk.Partitions() will return partitions even if there was a failure to
129+
// get one. Any errored partitions will not be returned.
128130
partitionStats,err:=disk.Partitions(true)
129-
iferr!=nil {
131+
iferr!=nil&&len(partitionStats)==0 {
132+
// Only return the error if there were no partitions returned.
130133
returnLSResponse{},xerrors.Errorf("failed to get partitions: %w",err)
131134
}
135+
132136
contents:=make([]LSFile,0,len(partitionStats))
133137
for_,a:=rangepartitionStats {
134138
// Drive letters on Windows have a trailing separator as part of their name.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp