Skip to content

Commit

Permalink
fix disk.Partitions on android
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Oct 18, 2021
1 parent dddeef7 commit 5cb5837
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion disk/disk_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"

Expand Down Expand Up @@ -221,7 +222,11 @@ var fsTypeMap = map[int64]string{
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
useMounts := false

filename := common.HostProc("1/mountinfo")
path := "1/mountinfo"
if runtime.GOOS == "android" {
path = "self/mountinfo"
}
filename := common.HostProc(path)
lines, err := common.ReadLines(filename)
if err != nil {
if err != err.(*os.PathError) {
Expand Down

0 comments on commit 5cb5837

Please sign in to comment.