From 4db4dc09a0b96ba9a6eb219b88915b48cf2a1eba Mon Sep 17 00:00:00 2001 From: shirou Date: Sun, 17 Oct 2021 12:59:41 +0000 Subject: [PATCH] [v3] fix Signal import on dragonfly OS in fallback --- .github/workflows/build_test.yml | 6 ++++-- v3/process/process_fallback.go | 3 +++ v3/process/process_posix.go | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index ebe1f5b..5857db9 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -16,6 +16,8 @@ jobs: go-version: ${{ matrix.go-version }} - name: Checkout code uses: actions/checkout@v2 + with: + path: ${{ github.workspace }}/src/github.com/shirou/gopsutil - name: Get dependencies if: runner.os != 'Windows' run: | @@ -24,13 +26,13 @@ jobs: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh echo "PATH=$GOPATH/bin:$PATH" >> $GITHUB_PATH fi - cd /home/runner/work/gopsutil/gopsutil/ + cd $GOPATH/src/github.com/shirou/gopsutil dep ensure # exclude v3 from being run with ./... rm -rf $GOPATH/src/github.com/shirou/gopsutil/v3 - name: Build Test v2 run: | - make build_test + cd $GOPATH/src/github.com/shirou/gopsutil && make build_test build_test_v3: strategy: matrix: diff --git a/v3/process/process_fallback.go b/v3/process/process_fallback.go index ee35306..6e54bab 100644 --- a/v3/process/process_fallback.go +++ b/v3/process/process_fallback.go @@ -4,12 +4,15 @@ package process import ( "context" + "syscall" "github.com/shirou/gopsutil/v3/cpu" "github.com/shirou/gopsutil/v3/internal/common" "github.com/shirou/gopsutil/v3/net" ) +type Signal = syscall.Signal + type MemoryMapsStat struct { Path string `json:"path"` Rss uint64 `json:"rss"` diff --git a/v3/process/process_posix.go b/v3/process/process_posix.go index fa38759..2e4a04e 100644 --- a/v3/process/process_posix.go +++ b/v3/process/process_posix.go @@ -82,7 +82,7 @@ func isMount(path string) bool { if err != nil { return false } - if fileInfo.Mode() & os.ModeSymlink != 0 { + if fileInfo.Mode()&os.ModeSymlink != 0 { return false } var stat1 unix.Stat_t